Beispiel #1
0
 /**
  * @dataProvider getTestsDependingOnExtensionAvailability
  */
 public function testGetAttributeCallExceptions($useExt = false)
 {
     $template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), $useExt);
     $object = new Twig_TemplateMagicMethodExceptionObject();
     $this->assertNull($template->getAttribute($object, 'foo'));
 }
 /**
  * @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));
 }
Beispiel #3
0
 /**
  * @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));
 }
Beispiel #4
0
 /**
  * @dataProvider getTestsDependingOnExtensionAvailability
  */
 public function testGetAttributeCallExceptions($useExt = false)
 {
     $template = new Twig_TemplateTest(new Twig_Environment(), $useExt);
     $object = new Twig_TemplateMagicMethodExceptionObject();
     $this->assertEquals(null, $template->getAttribute($object, 'foo'));
 }