diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index ab3e3b3556..9f1a3864ef 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -68,7 +68,7 @@ class helper $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $provider->set_ext_finder($manager->get_finder()); - $this->route_collection = $provider->find('./')->get_routes(); + $this->route_collection = $provider->find($phpbb_root_path)->get_routes(); } /** diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index e40fa280da..c633df7c38 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -84,7 +84,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case */ public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager,'', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } @@ -124,7 +124,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager,'', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } } diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php new file mode 100644 index 0000000000..c53d7265c4 --- /dev/null +++ b/tests/mock/controller_helper.php @@ -0,0 +1,22 @@ +template = $template; + $this->user = $user; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $provider->set_ext_finder($manager->get_finder()); + $this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); + } +}