mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/16314] Improve handling of page_footer output for controllers
Moved the common template output to controller helper and added garbage_collection handling to kernel_terminate_subscriber. PHPBB3-16314
This commit is contained in:
@@ -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 = $phpbb_root_path . 'adm/';
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
// Set correct current phpBB root path
|
||||
$this->root_path = $this->get_phpbb_root_path();
|
||||
@@ -186,7 +205,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description);
|
||||
}
|
||||
|
||||
@@ -230,7 +264,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description);
|
||||
}
|
||||
|
||||
@@ -274,7 +323,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description);
|
||||
}
|
||||
|
||||
@@ -318,7 +382,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description);
|
||||
}
|
||||
|
||||
@@ -362,7 +441,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description);
|
||||
}
|
||||
|
||||
@@ -406,7 +500,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description);
|
||||
}
|
||||
|
||||
@@ -447,7 +556,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description);
|
||||
}
|
||||
|
||||
@@ -491,7 +615,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description);
|
||||
}
|
||||
|
||||
@@ -523,7 +662,22 @@ 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,
|
||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
||||
$this->db,
|
||||
$this->dispatcher,
|
||||
$this->language,
|
||||
$this->template,
|
||||
$this->user,
|
||||
$this->config,
|
||||
$this->symfony_request,
|
||||
$this->request,
|
||||
$this->routing_helper,
|
||||
$this->admin_path,
|
||||
$this->php_ext
|
||||
);
|
||||
static::assertEquals($expected, $this->helper->route('controller1', array(), false, false, $type));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user