assertTrue(BSRegister::LoadModule('Input') instanceof BSInput);
}
public function testLoadBadModule()
{
BSRegister::LoadModule('nonExistentModule');
// TODO - use exceptions
// $this->assertError();
}
public function testSetGetAppPath()
{
BSRegister::SetAppPath(getcwd());
$this->assertEquals(getcwd() . DIRECTORY_SEPARATOR, BSRegister::GetAppPath());
}
public function testSetGetAppVersion()
{
BSRegister::SetAppVersion('1.0-test');
$this->assertEquals('1.0-test', BSRegister::GetAppVersion());
}
public function testSetGetApplication()
{
BSRegister::SetApplication('ISSO Tests');
$this->assertEquals('ISSO Tests', BSRegister::GetApplication());
}
public function testSetGetWebPath()
{
$path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO';
BSRegister::SetWebPath($path);
$this->assertEquals($path . DIRECTORY_SEPARATOR, BSRegister::GetWebPath());
}
public function testSetGetDebug()
{
BSRegister::SetDebug(true);
$this->assertSame(true, BSRegister::GetDebug());
}
public function testDebugList()
{
$this->assertEquals('', BSRegister::GetDebugList());
BSRegister::Debug('dbg');
$this->assertEquals('', BSRegister::GetDebugList());
}
public function testRegisterValue()
{
BSRegister::Register('someKey', 'someValue');
$registry = BSRegister::GetAll();
$this->assertEquals($registry['someKey'], 'someValue');
}
public function testGetAll()
{
BSRegister::Register('test', 1);
$this->assertType('array', BSRegister::GetAll());
$this->assertEquals(sizeof(BSRegister::GetAll()), 2);
}
public function testOverWriteRegister()
{
BSRegister::Register('valueToOverWrite', 1);
BSRegister::Register('valueToOverWrite', 2);
// TODO - use exceptions
// $this->assertError();
$this->assertEquals(1, BSRegister::Get('valueToOverWrite'));
}
public function testGet()
{
BSRegister::Register('testGet', 123);
$this->assertEquals(123, BSRegister::Get('testGet'));
}
public function testUnregister()
{
BSRegister::Register('testUnregister', 1);
BSRegister::Unregister('testUnregister');
BSRegister::Register('testUnregister', 2);
// TODO - use exceptions
// $this->assertNoErrors();
$this->assertEquals(2, BSRegister::Get('testUnregister'));
}
/* TODO - use exceptions
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->assertSame($input, BSRegister::GetType('Input'));
$this->assertEquals(null, BSRegister::GetType('Date'));
}
/* TODO - use exceptions
public function testRequiredModules()
{
BSRegister::RequiredModules(array('Input'));
$this->assertNoErrors();
BSRegister::RequiredModules(array('Input', 'Db'));
$this->assertError();
BSRegister::RequiredModules(array('Date'));
$this->assertError();
}
*/
}
?>