public function __construct(Twig_Environment $env, $useExtGetAttribute = false) { parent::__construct($env); $this->useExtGetAttribute = $useExtGetAttribute; self::$cache = array(); }
/** * @dataProvider getGetAttributeTests */ public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false) { $template = new Twig_TemplateTest(new Twig_Environment(null, array('strict_variables' => true)), $useExt); $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); }
/** * @dataProvider getGetAttributeTests */ public function testGetAttribute($expected, $object, $item, $arguments, $type) { $template = new Twig_TemplateTest(new Twig_Environment()); $this->assertEquals($expected, $template->getAttribute($object, $item, $arguments, $type)); }
/** * @dataProvider getTestsDependingOnExtensionAvailability */ public function testGetAttributeCallExceptions($useExt = false) { $template = new Twig_TemplateTest(new Twig_Environment(), $useExt); $object = new Twig_TemplateMagicMethodExceptionObject(); $this->assertNull($template->getAttribute($object, 'foo')); }