1 | <?php |
||
16 | abstract class BaseTwigTest extends \PHPUnit_Framework_TestCase |
||
17 | { |
||
18 | protected static $TEMP_PATH = '/../../tmp/'; |
||
19 | protected static $RESOURCE_PATH = '/../Resources/views/'; |
||
20 | protected static $TEMPLATE_PATH = '/../Resources/templates/'; |
||
21 | |||
22 | /** |
||
23 | * @var Filesystem |
||
24 | */ |
||
25 | protected static $fileSystem; |
||
26 | /** |
||
27 | * @var \Twig_Environment |
||
28 | */ |
||
29 | protected static $environment; |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | * |
||
34 | * @throws \Twig_Error_Loader |
||
35 | */ |
||
36 | public static function setUpBeforeClass() |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | * |
||
51 | * @throws \Symfony\Component\Filesystem\Exception\IOException |
||
52 | */ |
||
53 | public static function tearDownAfterClass() |
||
54 | { |
||
55 | if (in_array(getenv('DELETE_TEMP_FILES'), ['true', '1', 1, true], true)) { |
||
56 | static::$fileSystem->remove(__DIR__.static::$TEMP_PATH); |
||
57 | } |
||
58 | } |
||
59 | |||
60 | // |
||
61 | // PhpUnit |
||
62 | // |
||
63 | |||
64 | /** |
||
65 | * @return array |
||
66 | */ |
||
67 | abstract public function formatProvider(); |
||
68 | |||
69 | // |
||
70 | // Helper |
||
71 | // |
||
72 | |||
73 | /** |
||
74 | * @param string $templateName |
||
75 | * @param string $format |
||
76 | * |
||
77 | * @throws \Twig_Error_Syntax |
||
78 | * @throws \Twig_Error_Loader |
||
79 | * @throws \Symfony\Component\Filesystem\Exception\IOException |
||
80 | * @throws \InvalidArgumentException |
||
81 | * |
||
82 | * @return Spreadsheet|string |
||
83 | */ |
||
84 | protected function getDocument($templateName, $format) |
||
128 | } |
||
129 |