removed usage of deprecated classes in unit tests
authorFabien Potencier <fabien.potencier@gmail.com>
Mon, 5 Aug 2013 16:18:58 +0000 (18:18 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Mon, 5 Aug 2013 16:18:58 +0000 (18:18 +0200)
test/Twig/Tests/EnvironmentTest.php
test/Twig/Tests/IntegrationTest.php
test/Twig/Tests/Node/Expression/FunctionTest.php

index 22461b5..a5fc878 100644 (file)
@@ -218,21 +218,21 @@ class Twig_Tests_EnvironmentTest_Extension extends Twig_Extension
     public function getFilters()
     {
         return array(
-            'foo_filter' => new Twig_Filter_Function('foo_filter'),
+            new Twig_SimpleFilter('foo_filter', 'foo_filter'),
         );
     }
 
     public function getTests()
     {
         return array(
-            'foo_test' => new Twig_Test_Function('foo_test'),
+            new Twig_SimpleTest('foo_test', 'foo_test'),
         );
     }
 
     public function getFunctions()
     {
         return array(
-            'foo_function' => new Twig_Function_Function('foo_function'),
+            new Twig_SimpleFunction('foo_function', 'foo_function'),
         );
     }
 
index 5feb8f4..ea00b02 100644 (file)
@@ -136,24 +136,24 @@ class TwigTestExtension extends Twig_Extension
     public function getFilters()
     {
         return array(
-            '§'                => new Twig_Filter_Method($this, '§Filter'),
-            'escape_and_nl2br' => new Twig_Filter_Method($this, 'escape_and_nl2br', array('needs_environment' => true, 'is_safe' => array('html'))),
-            'nl2br'            => new Twig_Filter_Method($this, 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))),
-            'escape_something' => new Twig_Filter_Method($this, 'escape_something', array('is_safe' => array('something'))),
-            'preserves_safety' => new Twig_Filter_Method($this, 'preserves_safety', array('preserves_safety' => array('html'))),
-            '*_path'           => new Twig_Filter_Method($this, 'dynamic_path'),
-            '*_foo_*_bar'      => new Twig_Filter_Method($this, 'dynamic_foo'),
+            new Twig_SimpleFilter('§', array($this, '§Filter')),
+            new Twig_SimpleFilter('escape_and_nl2br', array($this, 'escape_and_nl2br'), array('needs_environment' => true, 'is_safe' => array('html'))),
+            new Twig_SimpleFilter('nl2br', array($this, 'nl2br'), array('pre_escape' => 'html', 'is_safe' => array('html'))),
+            new Twig_SimpleFilter('escape_something', array($this, 'escape_something'), array('is_safe' => array('something'))),
+            new Twig_SimpleFilter('preserves_safety', array($this, 'preserves_safety'), array('preserves_safety' => array('html'))),
+            new Twig_SimpleFilter('*_path', array($this, 'dynamic_path')),
+            new Twig_SimpleFilter('*_foo_*_bar', array($this, 'dynamic_foo')),
         );
     }
 
     public function getFunctions()
     {
         return array(
-            '§'           => new Twig_Function_Method($this, '§Function'),
-            'safe_br'     => new Twig_Function_Method($this, 'br', array('is_safe' => array('html'))),
-            'unsafe_br'   => new Twig_Function_Method($this, 'br'),
-            '*_path'      => new Twig_Function_Method($this, 'dynamic_path'),
-            '*_foo_*_bar' => new Twig_Function_Method($this, 'dynamic_foo'),
+            new Twig_SimpleFunction('§', array($this, '§Function')),
+            new Twig_SimpleFunction('safe_br', array($this, 'br'), array('is_safe' => array('html'))),
+            new Twig_SimpleFunction('unsafe_br', array($this, 'br')),
+            new Twig_SimpleFunction('*_path', array($this, 'dynamic_path')),
+            new Twig_SimpleFunction('*_foo_*_bar', array($this, 'dynamic_foo')),
         );
     }
 
index 431dc38..2693b2e 100644 (file)
@@ -36,10 +36,10 @@ class Twig_Tests_Node_Expression_FunctionTest extends Twig_Test_NodeTestCase
     public function getTests()
     {
         $environment = new Twig_Environment();
-        $environment->addFunction('foo', new Twig_Function_Function('foo', array()));
-        $environment->addFunction('bar', new Twig_Function_Function('bar', array('needs_environment' => true)));
-        $environment->addFunction('foofoo', new Twig_Function_Function('foofoo', array('needs_context' => true)));
-        $environment->addFunction('foobar', new Twig_Function_Function('foobar', array('needs_environment' => true, 'needs_context' => true)));
+        $environment->addFunction(new Twig_SimpleFunction('foo', 'foo', array()));
+        $environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true)));
+        $environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true)));
+        $environment->addFunction(new Twig_SimpleFunction('foobar', 'foobar', array('needs_environment' => true, 'needs_context' => true)));
 
         $tests = array();