public function testFailoverRequiresCasting() { $caster = new ViewableDataTest_Castable(); $container = new ViewableDataTest_Container(); $container->setFailover($caster); $this->assertInstanceOf('ViewableDataTest_RequiresCasting', $container->obj('alwaysCasted')); $this->assertInstanceOf('ViewableDataTest_RequiresCasting', $caster->obj('alwaysCasted')); $this->assertInstanceOf('ViewableData_Caster', $container->obj('noCastingInformation')); $this->assertInstanceOf('ViewableData_Caster', $caster->obj('noCastingInformation')); }
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); */ }