4 require_once('./../Loader.php');
10 * @copyright Copyright ©2002 - [#]year[#], Blue Static
15 class LoaderTest
extends UnitTestCase
18 * The new, main instance.
23 // ###################################################################
25 * Creates a new instance and makes sure it's the right class.
27 public function testNewRegister()
29 $this->instance
= BSLoader
::NewRegister();
31 $this->assertEqual(get_class($this->instance
), 'BSRegister');
34 // ###################################################################
36 * Checks that the return value of GetAllRegisters() is an array
37 * with the right size.
39 public function testGetAllRegisters()
41 $this->assertIsA(BSLoader
::GetAllRegisters(), 'array', 'Register array is not an array');
42 $this->assertEqual(sizeof(BSLoader
::GetAllRegisters()), 1, 'Register array is wrong size');
45 // ###################################################################
47 * Checks that we can set and get the main instance.
49 public function testSetGetRegister()
51 BSLoader
::SetRegister($this->instance
);
53 $this->assertReference(BSLoader
::GetRegister(), $this->instance
);
56 // ###################################################################
58 * Makes sure that the main instance stays the same after we add a new
61 public function testRegisterAfterMakeNew()
63 BSLoader
::NewRegister();
65 $this->assertEqual(get_class(BSLoader
::GetRegister(1)), 'BSRegister', 'Failed to get arbitrary register');
66 $this->assertEqual(sizeof(BSLoader
::GetAllRegisters()), 2, 'Sizeof register array is wrong');
67 $this->assertReference($this->instance
, BSLoader
::GetRegister(), 'Main register does not match instance');
70 // ###################################################################
72 * Tests that we can load a module.
74 public function testLoadModule()
76 $this->assertEqual(get_class(BSLoader
::LoadModule('Input')), 'BSInput');