You are here

public function Twig_Tests_TemplateTest::testGetAttributeStrict in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/test/Twig/Tests/TemplateTest.php \Twig_Tests_TemplateTest::testGetAttributeStrict()

@dataProvider getGetAttributeTests

File

vendor/twig/twig/test/Twig/Tests/TemplateTest.php, line 230

Class

Twig_Tests_TemplateTest

Code

public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null) {
  $template = new Twig_TemplateTest(new Twig_Environment($this
    ->getMock('Twig_LoaderInterface'), array(
    'strict_variables' => true,
  )), $useExt);
  if ($defined) {
    $this
      ->assertEquals($value, $template
      ->getAttribute($object, $item, $arguments, $type));
  }
  else {
    try {
      $this
        ->assertEquals($value, $template
        ->getAttribute($object, $item, $arguments, $type));
      throw new Exception('Expected Twig_Error_Runtime exception.');
    } catch (Twig_Error_Runtime $e) {
      if (null !== $exceptionMessage) {
        $this
          ->assertSame($exceptionMessage, $e
          ->getMessage());
      }
    }
  }
}