instance = BSLoader::NewRegister(); $this->assertEqual(get_class($this->instance), 'BSRegister'); } // ################################################################### /** * Checks that the return value of GetAllRegisters() is an array * with the right size. */ public function testGetAllRegisters() { $this->assertIsA(BSLoader::GetAllRegisters(), 'array', 'Register array is not an array'); $this->assertEqual(sizeof(BSLoader::GetAllRegisters()), 1, 'Register array is wrong size'); } // ################################################################### /** * Checks that we can set and get the main instance. */ public function testSetGetRegister() { BSLoader::SetRegister($this->instance); $this->assertReference(BSLoader::GetRegister(), $this->instance); } // ################################################################### /** * Makes sure that the main instance stays the same after we add a new * one. */ public function testRegisterAfterMakeNew() { BSLoader::NewRegister(); $this->assertEqual(get_class(BSLoader::GetRegister(1)), 'BSRegister', 'Failed to get arbitrary register'); $this->assertEqual(sizeof(BSLoader::GetAllRegisters()), 2, 'Sizeof register array is wrong'); $this->assertReference($this->instance, BSLoader::GetRegister(), 'Main register does not match instance'); } // ################################################################### /** * Tests that we can load a module. */ public function testLoadModule() { $this->assertEqual(get_class(BSLoader::LoadModule('Input')), 'BSInput'); } } ?>