diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml index eb884ace5f..9e2af7df23 100644 --- a/phpBB/config/default/container/services.yml +++ b/phpBB/config/default/container/services.yml @@ -87,17 +87,18 @@ services: arguments: - '@auth' - '@cache.driver' + - '@config' - '@cron.manager' - '@dbal.conn' - '@dispatcher' - '@language' - - '@template' - - '@user' - - '@config' - - '@symfony_request' - '@request' - '@routing.helper' - - '%core.root_path%%core.adm_relative_path%' + - '@symfony_request' + - '@template' + - '@user' + - '%core.root_path%' + - '%core.adm_relative_path%' - '%core.php_ext%' - '%debug.sql_explain%' diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 8e8cd135f6..8afdbd9c8d 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -40,6 +40,9 @@ class helper /** @var cache_interface */ protected $cache; + /** @var config */ + protected $config; + /** @var manager */ protected $cron_manager; @@ -52,34 +55,20 @@ class helper /** @var language */ protected $language; - /** - * Template object - * @var template - */ - protected $template; + /* @var request_interface */ + protected $request; - /** - * User object - * @var user - */ - protected $user; - - /** - * config object - * @var config - */ - protected $config; + /** @var routing_helper */ + protected $routing_helper; /* @var symfony_request */ protected $symfony_request; - /* @var request_interface */ - protected $request; + /** @var template */ + protected $template; - /** - * @var routing_helper - */ - protected $routing_helper; + /** @var user */ + protected $user; /** @var string */ protected $admin_path; @@ -95,23 +84,25 @@ class helper * * @param auth $auth Auth object * @param cache_interface $cache + * @param config $config Config object * @param manager $cron_manager - * @param driver_interface $db Dbal object + * @param driver_interface $db DBAL object * @param dispatcher $dispatcher * @param language $language - * @param template $template Template object - * @param user $user User object - * @param config $config Config object - * @param symfony_request $symfony_request Symfony Request object * @param request_interface $request phpBB request object * @param routing_helper $routing_helper Helper to generate the routes + * @param symfony_request $symfony_request Symfony Request object + * @param template $template Template object + * @param user $user User object + * @param string $root_path phpBB root path * @param string $admin_path Admin path * @param string $php_ext PHP extension * @param bool $sql_explain Flag whether to display sql explain */ - public function __construct(auth $auth, cache_interface $cache, manager $cron_manager, driver_interface $db, - dispatcher $dispatcher, language $language, template $template, user $user, config $config, - symfony_request $symfony_request, request_interface $request, routing_helper $routing_helper, + public function __construct(auth $auth, cache_interface $cache, config $config, manager $cron_manager, + driver_interface $db, dispatcher $dispatcher, language $language, + request_interface $request, routing_helper $routing_helper, + symfony_request $symfony_request, template $template, user $user, $root_path, $admin_path, $php_ext, $sql_explain = false) { $this->auth = $auth; @@ -126,7 +117,7 @@ class helper $this->symfony_request = $symfony_request; $this->request = $request; $this->routing_helper = $routing_helper; - $this->admin_path = $admin_path; + $this->admin_path = $root_path . $admin_path; $this->php_ext = $php_ext; $this->sql_explain = $sql_explain; } @@ -166,7 +157,7 @@ class helper * @param array $params String or array of additional url parameters * @param bool $is_amp Is url using & (true) or & (false) * @param string|bool $session_id Possibility to use a custom session id instead of the global one - * @param bool|string $reference_type The type of reference to be generated (one of the constants) + * @param int $reference_type The type of reference to be generated (one of the constants) * @return string The URL already passed through append_sid() */ public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH) diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index a357eddfe9..6945ffb7e9 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -158,7 +158,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->admin_path = 'adm/'; $this->php_ext = $phpEx; // Set correct current phpBB root path @@ -208,16 +208,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -267,16 +268,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -326,16 +328,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -385,16 +388,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -444,16 +448,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -503,16 +508,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -559,16 +565,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -618,16 +625,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); @@ -665,16 +673,17 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_ $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->template, - $this->user, - $this->config, - $this->symfony_request, $this->request, $this->routing_helper, + $this->symfony_request, + $this->template, + $this->user, + $this->root_path, $this->admin_path, $this->php_ext ); diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 7ee7bc14d7..38d250958d 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -65,17 +65,18 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $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)), - $this->template, - $this->user, - $this->config, - $symfony_request, $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);