From 6f936289ab32eaf2ebba23a3b95a9ed2e02889cd Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 14 Aug 2007 04:00:56 +0000 Subject: [PATCH] Moving the UnitTest directory out of the docs/ folder and into the root of the framework --- {docs/UnitTest => UnitTest}/AllTests.php | 0 {docs/UnitTest => UnitTest}/AppTest.php | 0 {docs/UnitTest => UnitTest}/Coverage.php | 0 .../DatabaseMySQLTest.php | 0 .../DatabaseMySQLiTest.php | 0 .../DatabaseTestAbstract.php | 0 {docs/UnitTest => UnitTest}/DatabaseTests.php | 0 {docs/UnitTest => UnitTest}/DateTest.php | 0 {docs/UnitTest => UnitTest}/FunctionsTest.php | 0 {docs/UnitTest => UnitTest}/InputTest.php | 0 UnitTest/RegisterTest.php | 139 ++++++++++++++++++ {docs/UnitTest => UnitTest}/XmlTest.php | 0 .../tests.config.php.new | 0 13 files changed, 139 insertions(+) rename {docs/UnitTest => UnitTest}/AllTests.php (100%) rename {docs/UnitTest => UnitTest}/AppTest.php (100%) rename {docs/UnitTest => UnitTest}/Coverage.php (100%) rename {docs/UnitTest => UnitTest}/DatabaseMySQLTest.php (100%) rename {docs/UnitTest => UnitTest}/DatabaseMySQLiTest.php (100%) rename {docs/UnitTest => UnitTest}/DatabaseTestAbstract.php (100%) rename {docs/UnitTest => UnitTest}/DatabaseTests.php (100%) rename {docs/UnitTest => UnitTest}/DateTest.php (100%) rename {docs/UnitTest => UnitTest}/FunctionsTest.php (100%) rename {docs/UnitTest => UnitTest}/InputTest.php (100%) create mode 100644 UnitTest/RegisterTest.php rename {docs/UnitTest => UnitTest}/XmlTest.php (100%) rename {docs/UnitTest => UnitTest}/tests.config.php.new (100%) diff --git a/docs/UnitTest/AllTests.php b/UnitTest/AllTests.php similarity index 100% rename from docs/UnitTest/AllTests.php rename to UnitTest/AllTests.php diff --git a/docs/UnitTest/AppTest.php b/UnitTest/AppTest.php similarity index 100% rename from docs/UnitTest/AppTest.php rename to UnitTest/AppTest.php diff --git a/docs/UnitTest/Coverage.php b/UnitTest/Coverage.php similarity index 100% rename from docs/UnitTest/Coverage.php rename to UnitTest/Coverage.php diff --git a/docs/UnitTest/DatabaseMySQLTest.php b/UnitTest/DatabaseMySQLTest.php similarity index 100% rename from docs/UnitTest/DatabaseMySQLTest.php rename to UnitTest/DatabaseMySQLTest.php diff --git a/docs/UnitTest/DatabaseMySQLiTest.php b/UnitTest/DatabaseMySQLiTest.php similarity index 100% rename from docs/UnitTest/DatabaseMySQLiTest.php rename to UnitTest/DatabaseMySQLiTest.php diff --git a/docs/UnitTest/DatabaseTestAbstract.php b/UnitTest/DatabaseTestAbstract.php similarity index 100% rename from docs/UnitTest/DatabaseTestAbstract.php rename to UnitTest/DatabaseTestAbstract.php diff --git a/docs/UnitTest/DatabaseTests.php b/UnitTest/DatabaseTests.php similarity index 100% rename from docs/UnitTest/DatabaseTests.php rename to UnitTest/DatabaseTests.php diff --git a/docs/UnitTest/DateTest.php b/UnitTest/DateTest.php similarity index 100% rename from docs/UnitTest/DateTest.php rename to UnitTest/DateTest.php diff --git a/docs/UnitTest/FunctionsTest.php b/UnitTest/FunctionsTest.php similarity index 100% rename from docs/UnitTest/FunctionsTest.php rename to UnitTest/FunctionsTest.php diff --git a/docs/UnitTest/InputTest.php b/UnitTest/InputTest.php similarity index 100% rename from docs/UnitTest/InputTest.php rename to UnitTest/InputTest.php diff --git a/UnitTest/RegisterTest.php b/UnitTest/RegisterTest.php new file mode 100644 index 0000000..b6f5938 --- /dev/null +++ b/UnitTest/RegisterTest.php @@ -0,0 +1,139 @@ +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 testDebugList() + { + $this->assertEqual('', BSRegister::GetDebugList()); + + BSRegister::Debug('dbg'); + $this->assertEqual('', BSRegister::GetDebugList()); + } + + 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(); + } +} + +?> \ No newline at end of file diff --git a/docs/UnitTest/XmlTest.php b/UnitTest/XmlTest.php similarity index 100% rename from docs/UnitTest/XmlTest.php rename to UnitTest/XmlTest.php diff --git a/docs/UnitTest/tests.config.php.new b/UnitTest/tests.config.php.new similarity index 100% rename from docs/UnitTest/tests.config.php.new rename to UnitTest/tests.config.php.new -- 2.43.5