Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
54 / 54 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_template_allfolder_test | |
100.00% |
54 / 54 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| test_allfolder | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setup_engine_for_allfolder | |
100.00% |
52 / 52 |
|
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_allfolder_test extends phpbb_template_template_test_case |
| 17 | { |
| 18 | protected $extension_manager; |
| 19 | protected $ext_template_path; |
| 20 | |
| 21 | public function test_allfolder() |
| 22 | { |
| 23 | $this->setup_engine_for_allfolder(); |
| 24 | |
| 25 | $this->run_template('foobar_body.html', array(), array(), array(), "All folder"); |
| 26 | } |
| 27 | |
| 28 | protected function setup_engine_for_allfolder(array $new_config = array()) |
| 29 | { |
| 30 | global $phpbb_root_path, $phpEx; |
| 31 | |
| 32 | $defaults = $this->config_defaults(); |
| 33 | $config = new \phpbb\config\config(array_merge($defaults, $new_config)); |
| 34 | $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); |
| 35 | $lang = new \phpbb\language\language($lang_loader); |
| 36 | $user = new \phpbb\user($lang, '\phpbb\datetime'); |
| 37 | $this->user = $user; |
| 38 | |
| 39 | $filesystem = new \phpbb\filesystem\filesystem(); |
| 40 | |
| 41 | $path_helper = new \phpbb\path_helper( |
| 42 | new \phpbb\symfony_request( |
| 43 | new phpbb_mock_request() |
| 44 | ), |
| 45 | $this->createMock('\phpbb\request\request'), |
| 46 | $phpbb_root_path, |
| 47 | $phpEx |
| 48 | ); |
| 49 | |
| 50 | $this->extension_manager = new phpbb_mock_extension_manager( |
| 51 | __DIR__ . '/', |
| 52 | array( |
| 53 | 'vendor4/bar' => array( |
| 54 | 'ext_name' => 'vendor4/bar', |
| 55 | 'ext_active' => '1', |
| 56 | 'ext_path' => 'ext/vendor4/bar/', |
| 57 | ), |
| 58 | ) |
| 59 | ); |
| 60 | |
| 61 | $cache_path = $phpbb_root_path . 'cache/twig'; |
| 62 | $context = new \phpbb\template\context(); |
| 63 | $loader = new \phpbb\template\twig\loader(''); |
| 64 | $log = new \phpbb\log\dummy(); |
| 65 | $assets_bag = new \phpbb\template\assets_bag(); |
| 66 | $twig = new \phpbb\template\twig\environment( |
| 67 | $assets_bag, |
| 68 | $config, |
| 69 | $filesystem, |
| 70 | $path_helper, |
| 71 | $cache_path, |
| 72 | $this->extension_manager, |
| 73 | $loader, |
| 74 | new \phpbb\event\dispatcher(), |
| 75 | array( |
| 76 | 'cache' => false, |
| 77 | 'debug' => false, |
| 78 | 'auto_reload' => true, |
| 79 | 'autoescape' => false, |
| 80 | ) |
| 81 | ); |
| 82 | $this->template = new \phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $twig, $this->user)), $this->extension_manager); |
| 83 | $twig->setLexer(new \phpbb\template\twig\lexer($twig)); |
| 84 | |
| 85 | $this->template_path = $this->test_path . '/templates'; |
| 86 | $this->ext_template_path = 'tests/extension/ext/vendor4/bar/styles/all/template'; |
| 87 | $this->template->set_custom_style('all', array($this->template_path, $this->ext_template_path)); |
| 88 | } |
| 89 | } |