Adding the Register test suite
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 16 Aug 2006 02:54:06 +0000 (02:54 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 16 Aug 2006 02:54:06 +0000 (02:54 +0000)
UnitTest/RegisterTest.php [new file with mode: 0644]

diff --git a/UnitTest/RegisterTest.php b/UnitTest/RegisterTest.php
new file mode 100644 (file)
index 0000000..4383ed7
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+
+// piggy
+require_once('./../Loader.php');
+
+/**
+* Register Test Suite
+*
+* @author              Blue Static
+* @copyright   Copyright ©2002 - [#]year[#], Blue Static
+* @version             $Revision$
+* @package             ISSO Tests
+* 
+*/
+class RegisterTest extends UnitTestCase
+{
+       protected $fixture;
+       
+       public function setUp()
+       {
+               $this->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