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

Merge pull request #5831 from marc1706/ticket/16314

[ticket/16314] Improve handling of page_footer output for controllers
This commit is contained in:
Marc Alexander
2020-02-06 17:19:33 +01:00
6 changed files with 398 additions and 115 deletions

View File

@@ -13,21 +13,33 @@
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
abstract class phpbb_controller_common_helper_route extends phpbb_test_case
abstract class phpbb_controller_common_helper_route extends phpbb_database_test_case
{
protected $root_path;
private $user;
private $config;
private $template;
private $extension_manager;
private $request;
private $symfony_request;
private $provider;
private $filesystem;
private $phpbb_path_helper;
private $helper;
private $router;
private $routing_helper;
protected $root_path;
private $auth;
private $cache;
private $db;
private $dispatcher;
private $language;
private $admin_path;
private $php_ext;
private $user;
private $config;
private $template;
private $extension_manager;
private $request;
private $symfony_request;
private $provider;
private $filesystem;
private $phpbb_path_helper;
private $helper;
private $router;
private $routing_helper;
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
}
public function setUp(): void
{
@@ -141,6 +153,13 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
);
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager);
$this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
$this->auth = new \phpbb\auth\auth();
$this->cache = new \phpbb\cache\driver\dummy();
$this->db = $this->new_dbal();
$this->dispatcher = new phpbb_mock_event_dispatcher();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->admin_path = 'adm/';
$this->php_ext = $phpEx;
// Set correct current phpBB root path
$this->root_path = $this->get_phpbb_root_path();
@@ -186,7 +205,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description);
}
@@ -230,7 +265,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description);
}
@@ -274,7 +325,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description);
}
@@ -318,7 +385,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description);
}
@@ -362,7 +445,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description);
}
@@ -406,7 +505,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description);
}
@@ -447,7 +562,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description);
}
@@ -491,7 +622,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
{
$this->config = new \phpbb\config\config(['enable_mod_rewrite' => '1']);
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description);
}
@@ -523,7 +670,23 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
));
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
$this->auth,
$this->cache,
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
$this->db,
$this->dispatcher,
$this->language,
$this->request,
$this->routing_helper,
$this->symfony_request,
$this->template,
$this->user,
$this->root_path,
$this->admin_path,
$this->php_ext
);
static::assertEquals($expected, $this->helper->route('controller1', array(), false, false, $type));
}
}

View File

@@ -42,7 +42,6 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
$filesystem = new \phpbb\filesystem\filesystem();
$manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
$loader = new \Symfony\Component\Routing\Loader\YamlFileLoader(
new \phpbb\routing\file_locator($filesystem, dirname(__FILE__) . '/')
);
@@ -58,8 +57,28 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
$request
);
$db = $this->getMockBuilder('\phpbb\db\driver\mysqli')
->disableOriginalConstructor()
->getMock();
$this->routing_helper = new \phpbb\routing\helper($this->config, $router, $symfony_request, $request, $filesystem, '', 'php');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $symfony_request, $request, $this->routing_helper);
$this->helper = new phpbb_mock_controller_helper(
new \phpbb\auth\auth(),
new \phpbb\cache\driver\dummy(),
$this->config,
new \phpbb\cron\manager([], $this->routing_helper, '', 'php'),
$db,
new phpbb_mock_event_dispatcher(),
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
$request,
$this->routing_helper,
$symfony_request,
$this->template,
$this->user,
$phpbb_root_path,
'adm/',
'php'
);
$this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher);
}