public function testFailoverRequiresCasting()
 {
     $caster = new ViewableDataTest_Castable();
     $container = new ViewableDataTest_Container($caster);
     $this->assertTrue($container->obj('alwaysCasted') instanceof ViewableDataTest_RequiresCasting);
     $this->assertTrue($caster->obj('alwaysCasted', null, false) instanceof ViewableDataTest_RequiresCasting);
     /* @todo - This currently fails, because the default_cast static variable is always taken from the topmost object,
     		 * not the failover object the field actually came from. Should we fix this, or declare current behaviour as correct?
     
     		$this->assertTrue($container->obj('noCastingInformation') instanceof ViewableData_Caster);
     		$this->assertFalse($caster->obj('noCastingInformation', null, false) instanceof ViewableData_Caster);
     		*/
 }
 public function testSetFailover()
 {
     $failover = new ViewableData();
     $container = new ViewableDataTest_Container();
     $container->setFailover($failover);
     $this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object');
     $this->assertFalse($container->hasMethod('testMethod'), 'testMethod() is already defined when it shouldn’t be');
     // Ensure that defined methods detected from the failover aren't cached when setting a new failover
     $container->setFailover(new ViewableDataTest_Failover());
     $this->assertTrue($container->hasMethod('testMethod'));
     // Test the reverse - that defined methods previously detected in a failover are removed if they no longer exist
     $container->setFailover($failover);
     $this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object');
     $this->assertFalse($container->hasMethod('testMethod'), 'testMethod() incorrectly reported as existing');
 }
 public function testSetFailover()
 {
     $failover = new ViewableData();
     $container = new ViewableDataTest_Container();
     $container->setFailover($failover);
     $this->assertSame($failover, $container->getFailover(), 'getFailover() returned a different object');
     $this->assertFalse($container->hasMethod('testMethod'), 'testMethod() is already defined when it shouldn’t be');
     // Ensure that defined methods detected from the failover aren't cached when setting a new failover
     $container->setFailover(new ViewableDataTest_Failover());
     $this->assertTrue($container->hasMethod('testMethod'));
 }