assertTrue(BSApp::LoadModule('Input') instanceof BSInput); } public function testLoadBadModule() { try { BSApp::LoadModule('nonExistentModule'); $this->fail('exception expected'); } catch (Exception $e) {} } public function testSetGetAppPath() { BSApp::SetAppPath(getcwd()); $this->assertEquals(getcwd() . DIRECTORY_SEPARATOR, BSApp::GetAppPath()); } public function testSetGetAppVersion() { BSApp::SetAppVersion('1.0-test'); $this->assertEquals('1.0-test', BSApp::GetAppVersion()); } public function testSetGetApplication() { BSApp::SetApplication('ISSO Tests'); $this->assertEquals('ISSO Tests', BSApp::GetApplication()); } public function testSetGetWebPath() { $path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO'; BSApp::SetWebPath($path); $this->assertEquals($path . DIRECTORY_SEPARATOR, BSApp::GetWebPath()); } public function testSetGetDebug() { BSApp::SetDebug(true); $this->assertSame(true, BSApp::GetDebug()); } public function testDebugList() { $this->assertEquals('', BSApp::GetDebugList()); BSApp::Debug('dbg'); $this->assertEquals('', BSApp::GetDebugList()); } public function testRegisterValue() { BSApp::Registry()->someKey = 'someValue'; $registry = BSApp::Registry(); $this->assertEquals($registry->someKey, 'someValue'); } public function testGetAll() { BSApp::Registry()->test = 1; $this->assertType('array', BSApp::Registry()->allObjects()); $this->assertSame(sizeof(BSApp::Registry()->allObjects()), 3); } public function testOverWriteRegister() { BSApp::Registry()->valueToOverWrite = 1; BSApp::Registry()->valueToOverWrite = 2; $this->assertEquals(2, BSApp::Registry()->valueToOverWrite); } public function testGet() { BSApp::Registry()->testGet = 123; $this->assertEquals(123, BSApp::Registry()->testGet); } public function testUnregister() { BSApp::Registry()->testUnregister = 1; unset(BSApp::Registry()->testUnregister); $this->assertObjectNotHasAttribute('testUnregister', BSApp::Registry()); } public function testGetNoExist() { try { BSApp::Registry()->doesNotExist; $this->fail('exception expected'); } catch (Exception $e) {} } public function testUnregisterNoExist() { try { unset(BSApp::Registry()->keyThatWontExist); $this->fail('exception expected'); } catch (Exception $e) {} } public function testGetType() { $input = BSApp::LoadModule('Input'); BSApp::Registry()->input = $input; $this->assertSame($input, BSApp::Registry()->getType('Input')); $this->assertEquals(null, BSApp::Registry()->getType('Date')); } public function testRequiredModules() { try { BSApp::RequiredModules(array('Input')); } catch (Exception $e) { $this->fail('unexpcted exception'); } try { BSApp::RequiredModules(array('Input', 'Db')); $this->fail('exception expected'); } catch (Exception $e) {} try { BSApp::RequiredModules(array('Date')); $this->fail('exception expected'); } catch (Exception $e) {} } } ?>