]>
src.bluestatic.org Git - isso.git/blob - UnitTest/RegisterTest.php
4 require_once('./../Register.php');
10 * @copyright Copyright ©2002 - [#]year[#], Blue Static
15 class RegisterTest
extends UnitTestCase
19 public function setUp()
21 $this->fixture
= BSRegister
::Instance();
24 public function testNewRegister()
26 $this->assertTrue($this->fixture
instanceof BSRegister
);
27 $this->assertReference($this->fixture
, BSRegister
::Instance());
30 public function testLoadModule()
32 $this->assertTrue(BSRegister
::LoadModule('Input') instanceof BSInput
);
35 public function testLoadBadModule()
37 BSRegister
::LoadModule('nonExistentModule');
41 public function testSetGetAppPath()
43 $this->fixture
->setAppPath(getcwd());
44 $this->assertEqual(getcwd() . DIRECTORY_SEPARATOR
, $this->fixture
->getAppPath());
47 public function testSetGetAppVersion()
49 $this->fixture
->setAppVersion('1.0-test');
50 $this->assertEqual('1.0-test', $this->fixture
->getAppVersion());
53 public function testSetGetApplication()
55 $this->fixture
->setApplication('ISSO Tests');
56 $this->assertEqual('ISSO Tests', $this->fixture
->getApplication());
59 public function testSetGetWebPath()
61 $path = DIRECTORY_SEPARATOR
. 'Server' . DIRECTORY_SEPARATOR
. 'htdocs' . DIRECTORY_SEPARATOR
. 'ISSO';
62 $this->fixture
->setWebPath($path);
63 $this->assertEqual($path . DIRECTORY_SEPARATOR
, $this->fixture
->getWebPath());
66 public function testSetGetDebug()
68 $this->fixture
->setDebug(true);
69 $this->assertIdentical(true, $this->fixture
->getDebug());
72 public function testRegisterValue()
74 $this->fixture
->register('someKey', 'someValue');
76 $registry = $this->fixture
->getAll();
77 $this->assertEqual($registry['someKey'], 'someValue');
80 public function testGetAll()
82 $this->fixture
->register('test', 1);
83 $this->assertIsA($this->fixture
->getAll(), 'array');
84 $this->assertEqual(sizeof($this->fixture
->getAll()), 2);
87 public function testOverWriteRegister()
89 $this->fixture
->register('valueToOverWrite', 1);
90 $this->fixture
->register('valueToOverWrite', 2);
92 $this->assertEqual(1, $this->fixture
->get('valueToOverWrite'));
95 public function testGet()
97 $this->fixture
->register('testGet', 123);
98 $this->assertEqual(123, $this->fixture
->get('testGet'));
101 public function testUnregister()
103 $this->fixture
->register('testUnregister', 1);
104 $this->fixture
->unregister('testUnregister');
105 $this->fixture
->register('testUnregister', 2);
106 $this->assertNoErrors();
107 $this->assertEqual(2, $this->fixture
->get('testUnregister'));
110 public function testGetNoExist()
112 $this->fixture
->get('doesNotExist');
113 $this->assertError();
116 public function testUnregisterNoExist()
118 $this->fixture
->unregister('keyThatWontExist');
119 $this->assertError();