@@ -17,6 +17,7 @@ public function setUp()
1717 $ loader = new Twig_Loader_Array ([
1818 'base_url ' => '{{ base_url( \'"><s>abc</s><a name="test \') }} ' ,
1919 'site_url ' => '{{ site_url( \'"><s>abc</s><a name="test \') }} ' ,
20+ 'anchor ' => '{{ anchor(uri, title, attributes) }} ' ,
2021 ]);
2122 $ setLoader = ReflectionHelper::getPrivateMethodInvoker (
2223 $ CI ->twig , 'setLoader '
@@ -28,17 +29,36 @@ public function setUp()
2829 );
2930 $ resetTwig ();
3031
32+ $ addFunctions = ReflectionHelper::getPrivateMethodInvoker (
33+ $ CI ->twig , 'addFunctions '
34+ );
35+ $ addFunctions ();
36+
3137 $ this ->obj = $ CI ->twig ;
3238 $ this ->twig = $ CI ->twig ->getTwig ();
3339 }
3440
35- public function test_safe_anchor ()
41+ public function test_anchor ()
3642 {
37- $ actual = $ this ->obj ->safe_anchor ('news/local/123 ' , 'My News ' , array ('title ' => 'The best news! ' ));
43+ $ actual = $ this ->twig ->render (
44+ 'anchor ' ,
45+ [
46+ 'uri ' => 'news/local/123 ' ,
47+ 'title ' => 'My News ' ,
48+ 'attributes ' => ['title ' => 'The best news! ' ]
49+ ]
50+ );
3851 $ expected = '<a href="http://localhost/index.php/news/local/123" title="The best news!">My News</a> ' ;
3952 $ this ->assertEquals ($ expected , $ actual );
40-
41- $ actual = $ this ->obj ->safe_anchor ('news/local/123 ' , '<s>abc</s> ' , array ('<s>name</s> ' => '<s>val</s> ' ));
53+
54+ $ actual = $ this ->twig ->render (
55+ 'anchor ' ,
56+ [
57+ 'uri ' => 'news/local/123 ' ,
58+ 'title ' => '<s>abc</s> ' ,
59+ 'attributes ' => ['<s>name</s> ' => '<s>val</s> ' ]
60+ ]
61+ );
4262 $ expected = '<a href="http://localhost/index.php/news/local/123" <s>name</s>="<s>val</s>"><s>abc</s></a> ' ;
4363 $ this ->assertEquals ($ expected , $ actual );
4464 }
0 commit comments