public function __get($name)
 {
     return ModularAuthUtility::getObject($name);
 }
 public function testObjectMethods()
 {
     $destination = new Object();
     $registered = new Object();
     ModularAuthUtility::registerObject('registered', $registered);
     ModularAuthUtility::bindObject($destination, 'registered');
     $this->assertTrue($destination->Registered === $registered);
     $this->assertTrue(ModularAuthUtility::isRegistered($registered));
     $Registered = new Object();
     $Registered->testVar = 1;
     ModularAuthUtility::registerObject(compact('Registered'));
     $this->assertFalse(isset($destination->Registered->testVar));
     ModularAuthUtility::bindObject($destination, 'Registered');
     $this->assertIdentical($destination->Registered->testVar, 1);
     ModularAuthUtility::unbindObject($destination, 'Registered');
     $this->assertFalse(isset($destination->Registered));
     ModularAuthUtility::registerObject('one', new Object());
     ModularAuthUtility::registerObject('two', new Object());
     ModularAuthUtility::registerObject('three', new Object());
     $this->assertTrue(ModularAuthUtility::isRegistered('One', 'Two', 'Three'));
     $this->assertIsA(ModularAuthUtility::getObject('one'), 'Object');
     ModularAuthUtility::bindObject($destination, array('one', array('two')), array(array(array('three'))));
     $this->assertTrue(isset($destination->One));
     $this->assertTrue(isset($destination->Two));
     $this->assertTrue(isset($destination->Three));
     ModularAuthUtility::bindObject('One', 'Two');
     $this->assertTrue(isset($destination->One->Two));
     ModularAuthUtility::unbindObject($destination, 'one', 'two', array(array('three', 'two', 'one')));
     $this->assertFalse(isset($destination->One));
     $this->assertFalse(isset($destination->Two));
     $this->assertFalse(isset($destination->Three));
     $this->assertTrue(ModularAuthUtility::isRegistered('Registered', 'One', 'Two', 'Three'));
     ModularAuthUtility::deleteObject('One');
     $this->assertFalse(ModularAuthUtility::isRegistered('Registered', 'One', 'Two', 'Three'));
     $this->assertTrue(ModularAuthUtility::flushObjects());
     $this->assertFalse(ModularAuthUtility::flushObjects());
     $this->assertFalse(ModularAuthUtility::isRegistered($Registered));
     $this->assertNull(ModularAuthUtility::isRegistered($fp = fopen(__FILE__, 'r')));
     fclose($fp);
     ModularAuthUtility::registerObject('Auth', $this->Auth);
     ModularAuthUtility::registerObject('Controller', $this->Controller);
     ModularAuthUtility::loadAuthenticator('MockModularAuthenticator');
     $this->assertTrue(ModularAuthUtility::flushObjects());
     try {
         ModularAuthUtility::bindObject($destination, 'UnredisteredObject');
         $this->fail('ModularAuthUtility::bindObject(UnredisteredObject) %s');
     } catch (Exception $e) {
         $this->assertIsA($e, 'ModularAuth_UnregisteredObjectException');
     }
     try {
         ModularAuthUtility::unbindObject($destination, 'UnredisteredObject');
         $this->fail('ModularAuthUtility::unbindObject(UnredisteredObject) %s');
     } catch (Exception $e) {
         $this->assertIsA($e, 'ModularAuth_UnregisteredObjectException');
     }
     try {
         ModularAuthUtility::getObject('UnredisteredObject');
         $this->fail('ModularAuthUtility::getObject(UnredisteredObject) %s');
     } catch (Exception $e) {
         $this->assertIsA($e, 'ModularAuth_UnregisteredObjectException');
     }
     try {
         ModularAuthUtility::deleteObject('UnredisteredObject');
         $this->fail('ModularAuthUtility::deleteObject(UnredisteredObject) %s');
     } catch (Exception $e) {
         $this->assertIsA($e, 'ModularAuth_UnregisteredObjectException');
     }
 }