]>
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
17 public function testLoadModule()
19 $this->assertTrue(BSRegister
::LoadModule('Input') instanceof BSInput
);
22 public function testLoadBadModule()
24 BSRegister
::LoadModule('nonExistentModule');
28 public function testSetGetAppPath()
30 BSRegister
::SetAppPath(getcwd());
31 $this->assertEqual(getcwd() . DIRECTORY_SEPARATOR
, BSRegister
::GetAppPath());
34 public function testSetGetAppVersion()
36 BSRegister
::SetAppVersion('1.0-test');
37 $this->assertEqual('1.0-test', BSRegister
::GetAppVersion());
40 public function testSetGetApplication()
42 BSRegister
::SetApplication('ISSO Tests');
43 $this->assertEqual('ISSO Tests', BSRegister
::GetApplication());
46 public function testSetGetWebPath()
48 $path = DIRECTORY_SEPARATOR
. 'Server' . DIRECTORY_SEPARATOR
. 'htdocs' . DIRECTORY_SEPARATOR
. 'ISSO';
49 BSRegister
::SetWebPath($path);
50 $this->assertEqual($path . DIRECTORY_SEPARATOR
, BSRegister
::GetWebPath());
53 public function testSetGetDebug()
55 BSRegister
::SetDebug(true);
56 $this->assertIdentical(true, BSRegister
::GetDebug());
59 public function testRegisterValue()
61 BSRegister
::Register('someKey', 'someValue');
63 $registry = BSRegister
::GetAll();
64 $this->assertEqual($registry['someKey'], 'someValue');
67 public function testGetAll()
69 BSRegister
::Register('test', 1);
70 $this->assertIsA(BSRegister
::GetAll(), 'array');
71 $this->assertEqual(sizeof(BSRegister
::GetAll()), 2);
74 public function testOverWriteRegister()
76 BSRegister
::Register('valueToOverWrite', 1);
77 BSRegister
::Register('valueToOverWrite', 2);
79 $this->assertEqual(1, BSRegister
::Get('valueToOverWrite'));
82 public function testGet()
84 BSRegister
::Register('testGet', 123);
85 $this->assertEqual(123, BSRegister
::Get('testGet'));
88 public function testUnregister()
90 BSRegister
::Register('testUnregister', 1);
91 BSRegister
::Unregister('testUnregister');
92 BSRegister
::Register('testUnregister', 2);
93 $this->assertNoErrors();
94 $this->assertEqual(2, BSRegister
::Get('testUnregister'));
97 public function testGetNoExist()
99 BSRegister
::Get('doesNotExist');
100 $this->assertError();
103 public function testUnregisterNoExist()
105 BSRegister
::Unregister('keyThatWontExist');
106 $this->assertError();