diff options
Diffstat (limited to 'tests/template')
| -rw-r--r-- | tests/template/template_allfolder_test.php | 22 | ||||
| -rw-r--r-- | tests/template/template_events_test.php | 23 | ||||
| -rw-r--r-- | tests/template/template_test_case.php | 22 | ||||
| -rw-r--r-- | tests/template/template_test_case_with_tree.php | 22 | 
4 files changed, 85 insertions, 4 deletions
diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php index b4ad84e9c3..e87688a57c 100644 --- a/tests/template/template_allfolder_test.php +++ b/tests/template/template_allfolder_test.php @@ -51,9 +51,29 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case  			)  		); +		$container = new phpbb_mock_container_builder(); +		$cache_path = $phpbb_root_path . 'cache/twig'; +		$context = new \phpbb\template\context(); +		$loader = new \phpbb\template\twig\loader(''); +		$twig = new \phpbb\template\twig\environment( +			$config, +			$path_helper, +			$container, +			$cache_path, +			$this->extension_manager, +			$loader, +			array( +				'cache'			=> false, +				'debug'			=> false, +				'auto_reload'	=> true, +				'autoescape'	=> false, +			) +		); +		$this->template = new \phpbb\template\twig\twig($path_helper, $config, $this->user, $context, $twig, $cache_path, array(new \phpbb\template\twig\extension($context, $this->user)), $this->extension_manager); +		$container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); +  		$this->template_path = $this->test_path . '/templates';  		$this->ext_template_path = 'tests/extension/ext/vendor4/bar/styles/all/template'; -		$this->template = new \phpbb\template\twig\twig($path_helper, $config, $this->user, new \phpbb\template\context(), $this->extension_manager);  		$this->template->set_custom_style('all', array($this->template_path, $this->ext_template_path));  	}  } diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index c415c969fe..e8ffea8d11 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -147,7 +147,28 @@ Zeta test event in all',  			$phpbb_root_path,  			$phpEx  		); -		$this->template = new \phpbb\template\twig\twig($path_helper, $config, $user, new \phpbb\template\context, $this->extension_manager); + +		$container = new phpbb_mock_container_builder(); +		$cache_path = $phpbb_root_path . 'cache/twig'; +		$context = new \phpbb\template\context(); +		$loader = new \phpbb\template\twig\loader(''); +		$twig = new \phpbb\template\twig\environment( +			$config, +			$path_helper, +			$container, +			$cache_path, +			$this->extension_manager, +			$loader, +			array( +				'cache'			=> false, +				'debug'			=> false, +				'auto_reload'	=> true, +				'autoescape'	=> false, +			) +		); +		$this->template = new \phpbb\template\twig\twig($path_helper, $config, $user, $context, $twig, $cache_path, array(new \phpbb\template\twig\extension($context, $this->user)), $this->extension_manager); +		$container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); +  		$this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path));  	}  } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 1250397401..f9ea8cfaba 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -78,7 +78,27 @@ class phpbb_template_template_test_case extends phpbb_test_case  		);  		$this->template_path = $this->test_path . '/templates'; -		$this->template = new \phpbb\template\twig\twig($path_helper, $config, $this->user, new \phpbb\template\context()); + +		$container = new phpbb_mock_container_builder(); +		$cache_path = $phpbb_root_path . 'cache/twig'; +		$context = new \phpbb\template\context(); +		$loader = new \phpbb\template\twig\loader(''); +		$twig = new \phpbb\template\twig\environment( +			$config, +			$path_helper, +			$container, +			$cache_path, +			null, +			$loader, +			array( +				'cache'			=> false, +				'debug'			=> false, +				'auto_reload'	=> true, +				'autoescape'	=> false, +			) +		); +		$this->template = new phpbb\template\twig\twig($path_helper, $config, $user, $context, $twig, $cache_path, array(new \phpbb\template\twig\extension($context, $this->user))); +		$container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig));  		$this->template->set_custom_style('tests', $this->template_path);  	} diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 68ecc4b706..c634e2051a 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -34,7 +34,27 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat  		$this->template_path = $this->test_path . '/templates';  		$this->parent_template_path = $this->test_path . '/parent_templates'; -		$this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $user, new phpbb\template\context()); + +		$container = new phpbb_mock_container_builder(); +		$cache_path = $phpbb_root_path . 'cache/twig'; +		$context = new \phpbb\template\context(); +		$loader = new \phpbb\template\twig\loader(''); +		$twig = new \phpbb\template\twig\environment( +			$config, +			$this->phpbb_path_helper, +			$container, +			$cache_path, +			null, +			$loader, +			array( +				'cache'			=> false, +				'debug'			=> false, +				'auto_reload'	=> true, +				'autoescape'	=> false, +			) +		); +		$this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $user, $context, $twig, $cache_path, array(new \phpbb\template\twig\extension($context, $this->user))); +		$container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig));  		$this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path));  	}  }  | 
