From e33020becfdc8e643c09331f81278fff35ad5546 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 13 Dec 2016 11:21:33 +0100 Subject: [PATCH] simplified a test --- test/Twig/Tests/CustomExtensionTest.php | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/Twig/Tests/CustomExtensionTest.php b/test/Twig/Tests/CustomExtensionTest.php index 56d3b2139..9c298f4e7 100644 --- a/test/Twig/Tests/CustomExtensionTest.php +++ b/test/Twig/Tests/CustomExtensionTest.php @@ -1,37 +1,39 @@ setExpectedException('InvalidArgumentException', $expectedExceptionMessage); - $loader = new \Twig_Loader_Array(array('foo' => '{{ foo }}')); - $env = new \Twig_Environment($loader); + $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); $env->addExtension($extension); - - $method = new \ReflectionMethod($env, 'initExtensions'); - $method->setAccessible(true); - $method->invoke($env); + $env->getUnaryOperators(); } public function provideInvalidExtensions() { return array( - array(new InvalidOperatorExtension(new \stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'), + array(new InvalidOperatorExtension(new stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'), array(new InvalidOperatorExtension(array(1, 2, 3)), '"InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'), ); } } -final class InvalidOperatorExtension implements \Twig_ExtensionInterface +class InvalidOperatorExtension implements Twig_ExtensionInterface { private $operators;