fixture = BSRegister::Instance(); } public function testNewRegister() { $this->assertTrue($this->fixture instanceof BSRegister); $this->assertReference($this->fixture, BSRegister::Instance()); } public function testLoadModule() { $this->assertTrue(BSRegister::LoadModule('Input') instanceof BSInput); } public function testLoadBadModule() { BSRegister::LoadModule('nonExistentModule'); $this->assertError(); } public function testSetGetAppPath() { $this->fixture->setAppPath(getcwd()); $this->assertEqual(getcwd() . DIRECTORY_SEPARATOR, $this->fixture->getAppPath()); } public function testSetGetAppVersion() { $this->fixture->setAppVersion('1.0-test'); $this->assertEqual('1.0-test', $this->fixture->getAppVersion()); } public function testSetGetApplication() { $this->fixture->setApplication('ISSO Tests'); $this->assertEqual('ISSO Tests', $this->fixture->getApplication()); } public function testSetGetWebPath() { $path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO'; $this->fixture->setWebPath($path); $this->assertEqual($path . DIRECTORY_SEPARATOR, $this->fixture->getWebPath()); } public function testSetGetDebug() { $this->fixture->setDebug(true); $this->assertIdentical(true, $this->fixture->getDebug()); } public function testRegisterValue() { $this->fixture->register('someKey', 'someValue'); $registry = $this->fixture->getAll(); $this->assertEqual($registry['someKey'], 'someValue'); } public function testGetAll() { $this->fixture->register('test', 1); $this->assertIsA($this->fixture->getAll(), 'array'); $this->assertEqual(sizeof($this->fixture->getAll()), 2); } public function testOverWriteRegister() { $this->fixture->register('valueToOverWrite', 1); $this->fixture->register('valueToOverWrite', 2); $this->assertError(); $this->assertEqual(1, $this->fixture->get('valueToOverWrite')); } public function testGet() { $this->fixture->register('testGet', 123); $this->assertEqual(123, $this->fixture->get('testGet')); } public function testUnregister() { $this->fixture->register('testUnregister', 1); $this->fixture->unregister('testUnregister'); $this->fixture->register('testUnregister', 2); $this->assertNoErrors(); $this->assertEqual(2, $this->fixture->get('testUnregister')); } public function testGetNoExist() { $this->fixture->get('doesNotExist'); $this->assertError(); } public function testUnregisterNoExist() { $this->fixture->unregister('keyThatWontExist'); $this->assertError(); } } ?>