From 360c469295192077d8d4d828017d6135ac888c85 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 16 Aug 2006 02:54:06 +0000 Subject: [PATCH] Adding the Register test suite --- UnitTest/RegisterTest.php | 99 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 UnitTest/RegisterTest.php diff --git a/UnitTest/RegisterTest.php b/UnitTest/RegisterTest.php new file mode 100644 index 0000000..4383ed7 --- /dev/null +++ b/UnitTest/RegisterTest.php @@ -0,0 +1,99 @@ +fixture = BSLoader::NewRegister(); + } + + public function testSetGetAppPath() + { + $this->fixture->setAppPath(getcwd()); + $this->assertEquals(getcwd() . DIRECTORY_SEPARATOR, $this->fixture->getAppPath()); + } + + public function testSetGetAppVersion() + { + $this->fixture->setAppVersion('1.0-test'); + $this->assertEquals('1.0-test', $this->fixture->getAppVersion()); + } + + public function testSetGetApplication() + { + $this->fixture->setApplication('ISSO Tests'); + $this->assertEquals('ISSO Tests', $this->fixture->getApplication()); + } + + public function testSetGetWebPath() + { + $path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO'; + $this->fixture->setWebPath($path); + $this->assertEquals($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->assertIsA($this->fixture->getAll(), 'array'); + $this->assertEqual(sizeof($this->fixture->getAll()), 1); + } + + 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(); + } +} + +?> \ No newline at end of file -- 2.22.5