3 require_once 'PHPUnit/Framework.php';
4 require_once ISSO
. '/Installer.php';
5 require_once ISSO
. '/Input.php';
7 class InstallerTest
extends PHPUnit_Framework_TestCase
12 public function setUp()
14 $this->input
= BSApp
::$input = new BSInput();
15 TestInstallerFixture
::$rig = $this;
18 private function _loadClass()
21 $this->fixture
= new TestInstallerFixture('InstallerTest.php');
22 $data = ob_get_contents();
28 public function stepCheck($step)
30 $this->assertEquals($this->input
->in
['step'], $step);
33 public function testWelcome()
35 $this->input
->in
['step'] = 0;
36 $data = $this->_loadClass();
37 $this->assertTrue(strpos($data, 'This is a welcome page.') !== false
);
40 public function testStep1()
42 $this->input
->in
['step'] = 1;
43 $data = $this->_loadClass();
44 $this->assertTrue(strpos($data, '<div class="buttonlink"><a href="InstallerTest.php?step=2">Next Step</a></div>') !== false
);
47 public function testLastStep()
49 $this->input
->in
['step'] = 2;
50 $data = $this->_loadClass();
51 $this->assertTrue(strpos($data, '<div class="buttonlink">FINAL LINK</div>') !== false
);
55 class TestInstallerFixture
extends BSInstaller
59 protected function _pageTitle()
61 return 'Test Installer';
64 protected function _finalLink()
69 protected function _welcomePage()
71 echo 'This is a welcome page.';
74 public function step1()
76 self
::$rig->stepCheck(1);
79 public function step2()
81 self
::$rig->stepCheck(2);