assertTrue(BSRegister::LoadModule('Input') instanceof BSInput); } public function testLoadBadModule() { BSRegister::LoadModule('nonExistentModule'); $this->assertError(); } public function testSetGetAppPath() { BSRegister::SetAppPath(getcwd()); $this->assertEqual(getcwd() . DIRECTORY_SEPARATOR, BSRegister::GetAppPath()); } public function testSetGetAppVersion() { BSRegister::SetAppVersion('1.0-test'); $this->assertEqual('1.0-test', BSRegister::GetAppVersion()); } public function testSetGetApplication() { BSRegister::SetApplication('ISSO Tests'); $this->assertEqual('ISSO Tests', BSRegister::GetApplication()); } public function testSetGetWebPath() { $path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO'; BSRegister::SetWebPath($path); $this->assertEqual($path . DIRECTORY_SEPARATOR, BSRegister::GetWebPath()); } public function testSetGetDebug() { BSRegister::SetDebug(true); $this->assertIdentical(true, BSRegister::GetDebug()); } public function testRegisterValue() { BSRegister::Register('someKey', 'someValue'); $registry = BSRegister::GetAll(); $this->assertEqual($registry['someKey'], 'someValue'); } public function testGetAll() { BSRegister::Register('test', 1); $this->assertIsA(BSRegister::GetAll(), 'array'); $this->assertEqual(sizeof(BSRegister::GetAll()), 2); } public function testOverWriteRegister() { BSRegister::Register('valueToOverWrite', 1); BSRegister::Register('valueToOverWrite', 2); $this->assertError(); $this->assertEqual(1, BSRegister::Get('valueToOverWrite')); } public function testGet() { BSRegister::Register('testGet', 123); $this->assertEqual(123, BSRegister::Get('testGet')); } public function testUnregister() { BSRegister::Register('testUnregister', 1); BSRegister::Unregister('testUnregister'); BSRegister::Register('testUnregister', 2); $this->assertNoErrors(); $this->assertEqual(2, BSRegister::Get('testUnregister')); } public function testGetNoExist() { BSRegister::Get('doesNotExist'); $this->assertError(); } public function testUnregisterNoExist() { BSRegister::Unregister('keyThatWontExist'); $this->assertError(); } public function testGetType() { $input = BSRegister::LoadModule('Input'); BSRegister::Register('input', $input); $this->assertReference($input, BSRegister::GetType('Input')); $this->assertEqual(null, BSRegister::GetType('Date')); } public function testRequiredModules() { BSRegister::RequiredModules(array('Input')); $this->assertNoErrors(); BSRegister::RequiredModules(array('Input', 'Db')); $this->assertError(); BSRegister::RequiredModules(array('Date')); $this->assertError(); } } ?>