1
1
<?php
2
2
namespace TwigGenerator \Tests \Extension ;
3
3
4
+ use PHPUnit \Framework \TestCase ;
4
5
use Twig \Environment ;
5
6
use Twig \Extension \AbstractExtension ;
6
7
use Twig \Loader \ArrayLoader ;
14
15
* @package TwigGenerator\Tests\Extension
15
16
* @author Stéphane Escandell
16
17
*/
17
- abstract class BaseExtensionTest extends \PHPUnit_Framework_TestCase
18
+ abstract class AbstractExtensionTestCase extends TestCase
18
19
{
19
20
/**
20
21
* Variables used for templates
@@ -40,16 +41,16 @@ protected function runTwigTests(array $templates, array $returns): void
40
41
'Error: invalid test case. Templates and returns keys mismatch: templates:[%s], returns:[%s] => [%s] ' ,
41
42
implode (', ' , array_keys ($ templates )),
42
43
implode (', ' , array_keys ($ returns )),
43
- implode (', ' , array_diff (array_keys ($ templates ), array_keys ($ returns )))
44
+ implode (', ' , array_diff (array_keys ($ templates ), array_keys ($ returns ))),
44
45
));
45
46
}
46
47
$ twig = $ this ->getEnvironment ($ templates );
47
48
48
49
foreach ($ templates as $ name => $ tpl ) {
49
50
$ this ->assertEquals (
50
51
$ returns [$ name ][0 ],
51
- $ twig ->loadTemplate ($ name)-> render ( $ this ->twigVariables ),
52
- $ returns [$ name ][1 ]
52
+ $ twig ->render ($ name, $ this ->twigVariables ),
53
+ $ returns [$ name ][1 ],
53
54
);
54
55
}
55
56
}
0 commit comments