1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +02:00

[ticket/15905] Try with existing phpbb extension

PHPBB3-15905
This commit is contained in:
mrgoldy
2018-12-09 23:52:50 +01:00
committed by Marc Alexander
parent 012fe18879
commit 7989f3f71f
12 changed files with 77 additions and 109 deletions

View File

@@ -74,7 +74,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
protected function generate_route_objects()
{
global $request;
global $request, $phpbb_root_path, $phpEx;
$auth = $this->getMock('\phpbb\auth\auth');
$this->request = new phpbb_mock_request();
$this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
@@ -122,7 +124,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
'autoescape' => false,
)
);
$this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $twig, $this->user)));
$this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)));
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
$this->extension_manager = new phpbb_mock_extension_manager(

View File

@@ -66,7 +66,15 @@ class phpbb_email_parsing_test extends phpbb_test_case
);
$phpbb_container->set('ext.manager', $extension_manager);
$auth = $this->getMock('\phpbb\auth\auth');
$context = new \phpbb\template\context();
$twig_extension = new \phpbb\template\twig\extension($auth, $context, $lang);
$phpbb_container->set('template.twig.extensions.phpbb', $twig_extension);
$twig_extensions_collection = new \phpbb\di\service_collection($phpbb_container);
$twig_extensions_collection->add('template.twig.extensions.phpbb');
$phpbb_container->set('template.twig.extensions.collection', $twig_extensions_collection);
$twig = new \phpbb\template\twig\environment(
$config,
$filesystem,

View File

@@ -36,6 +36,8 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
parent::setUp();
$auth = $this->getMock('\phpbb\auth\auth');
$this->config = new \phpbb\config\config(array(
'version' => '3.1.0',
));
@@ -111,7 +113,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$lang = new \phpbb\language\language($lang_loader);
$this->user = new \phpbb\user($lang, '\phpbb\datetime');
$this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $twig, $this->user)));
$this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)));
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
}

View File

@@ -26,6 +26,8 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
{
global $phpbb_root_path, $phpEx;
$auth = $this->getMock('\phpbb\auth\auth');
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
@@ -75,7 +77,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
'autoescape' => false,
)
);
$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);
$this->template = new \phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)), $this->extension_manager);
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
$this->template_path = $this->test_path . '/templates';

View File

@@ -131,6 +131,8 @@ Zeta test event in all',
{
global $phpbb_root_path, $phpEx, $user;
$auth = $this->getMock('\phpbb\auth\auth');
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
@@ -169,7 +171,7 @@ Zeta test event in all',
'autoescape' => false,
)
);
$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);
$this->template = new \phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)), $this->extension_manager);
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
$this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path));

View File

@@ -25,6 +25,8 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
{
global $phpbb_root_path, $phpEx, $user;
$auth = $this->getMock('\phpbb\auth\auth');
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
@@ -68,7 +70,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$twig,
$cache_path,
$this->user,
array(new \phpbb\template\twig\extension($context, $twig, $this->user)),
array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)),
new phpbb_mock_extension_manager(
dirname(__FILE__) . '/',
array(

View File

@@ -73,6 +73,8 @@ class phpbb_template_template_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
$auth = $this->getMock('\phpbb\auth\auth');
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
@@ -113,7 +115,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
'autoescape' => false,
)
);
$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->template = new phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)));
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
$this->template->set_custom_style('tests', $this->template_path);
}

View File

@@ -19,6 +19,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
{
global $phpbb_root_path, $phpEx, $user;
$auth = $this->getMock('\phpbb\auth\auth');
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
@@ -56,7 +58,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
'autoescape' => false,
)
);
$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)));
$this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($auth, $context, $twig, $this->user)));
$twig->setLexer(new \phpbb\template\twig\lexer($twig));
$this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path));
}