Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
38 / 38 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_template_template_test_case_with_tree | |
100.00% |
38 / 38 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| setup_engine | |
100.00% |
38 / 38 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | require_once __DIR__ . '/template_test_case.php'; |
| 15 | |
| 16 | class phpbb_template_template_test_case_with_tree extends phpbb_template_template_test_case |
| 17 | { |
| 18 | /** @var \phpbb\path_helper */ |
| 19 | protected $phpbb_path_helper; |
| 20 | |
| 21 | /** @var string */ |
| 22 | protected $parent_template_path; |
| 23 | |
| 24 | protected function setup_engine(array $new_config = [], string $template_path = '') |
| 25 | { |
| 26 | global $phpbb_root_path, $phpEx, $user; |
| 27 | |
| 28 | $defaults = $this->config_defaults(); |
| 29 | $config = new \phpbb\config\config(array_merge($defaults, $new_config)); |
| 30 | |
| 31 | $filesystem = new \phpbb\filesystem\filesystem(); |
| 32 | |
| 33 | $this->phpbb_path_helper = new \phpbb\path_helper( |
| 34 | new \phpbb\symfony_request( |
| 35 | new phpbb_mock_request() |
| 36 | ), |
| 37 | $this->createMock('\phpbb\request\request'), |
| 38 | $phpbb_root_path, |
| 39 | $phpEx |
| 40 | ); |
| 41 | |
| 42 | $this->template_path = $this->test_path . '/templates'; |
| 43 | $this->parent_template_path = $this->test_path . '/parent_templates'; |
| 44 | |
| 45 | $cache_path = $phpbb_root_path . 'cache/twig'; |
| 46 | $context = new \phpbb\template\context(); |
| 47 | $loader = new \phpbb\template\twig\loader(''); |
| 48 | $log = new \phpbb\log\dummy(); |
| 49 | $assets_bag = new \phpbb\template\assets_bag(); |
| 50 | $twig = new \phpbb\template\twig\environment( |
| 51 | $assets_bag, |
| 52 | $config, |
| 53 | $filesystem, |
| 54 | $this->phpbb_path_helper, |
| 55 | $cache_path, |
| 56 | null, |
| 57 | $loader, |
| 58 | new \phpbb\event\dispatcher(), |
| 59 | array( |
| 60 | 'cache' => false, |
| 61 | 'debug' => false, |
| 62 | 'auto_reload' => true, |
| 63 | 'autoescape' => false, |
| 64 | ) |
| 65 | ); |
| 66 | $this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $twig, $this->user))); |
| 67 | $twig->setLexer(new \phpbb\template\twig\lexer($twig)); |
| 68 | $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); |
| 69 | } |
| 70 | } |