4 require_once('PHPUnit2/Framework/IncompleteTestError.php');
5 require_once('PHPUnit2/Framework/TestCase.php');
8 require_once('./../Loader.php');
14 * @copyright Copyright ©2002 - [#]year[#], Blue Static
19 class LoaderTest
extends PHPUnit2_Framework_TestCase
22 * The new, main instance.
27 // ###################################################################
29 * Creates a new instance and makes sure it's the right class.
31 public function testNewRegister()
33 $this->instance
= BSLoader
::NewRegister();
35 $this->assertEquals(get_class($this->instance
), 'BSRegister');
38 // ###################################################################
40 * Checks that the return value of GetAllRegisters() is an array
41 * with the right size.
43 public function testGetAllRegisters()
45 $this->assertType(BSLoader
::GetAllRegisters(), 'array', 'Register array is not an array');
46 $this->assertEquals(sizeof(BSLoader
::GetAllRegisters()), 1, 'Register array is wrong size');
49 // ###################################################################
51 * Checks that we can set and get the main instance.
53 public function testSetGetRegister()
55 BSLoader
::SetRegister($this->instance
);
57 $this->assertSame(BSLoader
::GetRegister(), $this->instance
);
60 // ###################################################################
62 * Makes sure that the main instance stays the same after we add a new
65 public function testRegisterAfterMakeNew()
67 BSLoader
::NewRegister();
69 $this->assertEquals(get_class(BSLoader
::GetRegister(1), 'BSRegister'), 'Failed to get arbitrary register');
70 $this->assertEquals(sizeof(BSLoader
::GetAllRegisters()), 2, 'Sizeof register array is wrong');
71 $this->assertSame($this->instance
, BSLoader
::GetRegister(), 'Main register does not match instance');
74 // ###################################################################
76 * Tests that we can load a module.
78 public function testLoadModule()
80 $this->assertEquals(get_class(BSLoader
::LoadModule('Input')), 'BSInput');