From d892dfe084fda1cb48f228b0c89f20f9f2430403 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 18 Sep 2014 23:22:48 +0200 Subject: [PATCH 01/11] [ticket/13073] Add phpbb root path with mod rewrite enabled for proper routes PHPBB3-13073 --- phpBB/phpbb/controller/helper.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index e2932086db..5bca8edbaa 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -140,8 +140,16 @@ class helper // If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it. $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url); - // We need to update the base url to move to the directory of the app.php file. - $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url); + if (empty($this->config['enable_mod_rewrite'])) + { + // We need to update the base url to move to the directory of the app.php file. + $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url); + } + else + { + // We need to append the phpbb_root_path for proper routes + $base_url .= preg_replace('#[\\/\\\]$#', '', preg_replace('#^\.#', '', $this->phpbb_root_path)); + } $base_url = $this->filesystem->clean_path($base_url); From a70addbf14bde4be8c8181d09baf37084c5362f2 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 00:07:31 +0200 Subject: [PATCH 02/11] [ticket/13073] Add tests for routes from adm pages PHPBB3-13073 --- tests/controller/helper_route_adm_test.php | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 tests/controller/helper_route_adm_test.php diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php new file mode 100644 index 0000000000..bd462fa359 --- /dev/null +++ b/tests/controller/helper_route_adm_test.php @@ -0,0 +1,148 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/helper_route_test.php'; + +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test +{ + public function setUp() + { + global $phpbb_dispatcher, $phpbb_root_path, $phpEx; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + $this->user = new \phpbb\user('\phpbb\datetime'); + + $request = new phpbb_mock_request(); + $request->overwrite('SCRIPT_NAME', '/adm/index.php', \phpbb\request\request_interface::SERVER); + $request->overwrite('SCRIPT_FILENAME', 'index.php', \phpbb\request\request_interface::SERVER); + $request->overwrite('REQUEST_URI', '/adm/index.php', \phpbb\request\request_interface::SERVER); + $request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER); + $request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER); + + $this->symfony_request = new \phpbb\symfony_request( + $request + ); + $this->filesystem = new \phpbb\filesystem(); + $phpbb_path_helper = new \phpbb\path_helper( + $this->symfony_request, + $this->filesystem, + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + $phpEx + ); + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context()); + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + ) + ); + + $finder = new \phpbb\finder( + new \phpbb\filesystem(), + dirname(__FILE__) . '/', + new phpbb_mock_cache() + ); + $finder->set_extensions(array_keys($this->extension_manager->all_enabled())); + $this->provider = new \phpbb\controller\provider(); + $this->provider->find_routing_files($finder); + $this->provider->find(dirname(__FILE__) . '/'); + } + + /** + * @dataProvider helper_url_data_no_rewrite() + */ + public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); + } + + /** + * @dataProvider helper_url_data_with_rewrite() + */ + 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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); + } + + /** + * @dataProvider helper_url_data_absolute() + */ + public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL)); + } + + /** + * @dataProvider helper_url_data_relative_path() + */ + public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH)); + } + + /** + * @dataProvider helper_url_data_network() + */ + public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH)); + } + + /** + * @dataProvider helper_url_data_absolute_with_rewrite() + */ + public function test_helper_url_absolute_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL)); + } + + /** + * @dataProvider helper_url_data_relative_path_with_rewrite() + */ + public function test_helper_url_relative_path_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH)); + } + + /** + * @dataProvider helper_url_data_network_with_rewrite() + */ + public function test_helper_url_network_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH)); + } +} From d74f45aee0164d6189c3bb4182d67f345b1d9d6e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 00:11:36 +0200 Subject: [PATCH 03/11] [ticket/13073] Test that routes from subfolders like /adm work PHPBB3-13073 --- tests/controller/helper_route_adm_test.php | 96 +--------------------- tests/controller/helper_route_test.php | 18 ++-- 2 files changed, 13 insertions(+), 101 deletions(-) diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php index bd462fa359..ec7fc0c490 100644 --- a/tests/controller/helper_route_adm_test.php +++ b/tests/controller/helper_route_adm_test.php @@ -22,8 +22,7 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou { global $phpbb_dispatcher, $phpbb_root_path, $phpEx; - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = new \phpbb\user('\phpbb\datetime'); + parent::setUp(); $request = new phpbb_mock_request(); $request->overwrite('SCRIPT_NAME', '/adm/index.php', \phpbb\request\request_interface::SERVER); @@ -43,18 +42,6 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou $phpbb_root_path, $phpEx ); - $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context()); - $this->extension_manager = new phpbb_mock_extension_manager( - dirname(__FILE__) . '/', - array( - 'vendor2/foo' => array( - 'ext_name' => 'vendor2/foo', - 'ext_active' => '1', - 'ext_path' => 'ext/vendor2/foo/', - ), - ) - ); $finder = new \phpbb\finder( new \phpbb\filesystem(), @@ -65,84 +52,7 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou $this->provider = new \phpbb\controller\provider(); $this->provider->find_routing_files($finder); $this->provider->find(dirname(__FILE__) . '/'); - } - - /** - * @dataProvider helper_url_data_no_rewrite() - */ - public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) - { - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); - } - - /** - * @dataProvider helper_url_data_with_rewrite() - */ - 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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); - } - - /** - * @dataProvider helper_url_data_absolute() - */ - public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description) - { - $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL)); - } - - /** - * @dataProvider helper_url_data_relative_path() - */ - public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description) - { - $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH)); - } - - /** - * @dataProvider helper_url_data_network() - */ - public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description) - { - $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH)); - } - - /** - * @dataProvider helper_url_data_absolute_with_rewrite() - */ - public function test_helper_url_absolute_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL)); - } - - /** - * @dataProvider helper_url_data_relative_path_with_rewrite() - */ - public function test_helper_url_relative_path_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH)); - } - - /** - * @dataProvider helper_url_data_network_with_rewrite() - */ - public function test_helper_url_network_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/'); - $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH)); + // Set correct current phpBB root path + $this->root_path = './../'; } } diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index e906e79164..94e006166a 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -17,6 +17,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class phpbb_controller_helper_route_test extends phpbb_test_case { + protected $root_path; + public function setUp() { global $phpbb_dispatcher, $phpbb_root_path, $phpEx; @@ -101,7 +103,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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } @@ -141,7 +143,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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } @@ -181,7 +183,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL)); } @@ -221,7 +223,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH)); } @@ -261,7 +263,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH)); } //TODO @@ -301,7 +303,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_absolute_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL)); } @@ -341,7 +343,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_relative_path_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH)); } @@ -381,7 +383,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_network_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_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH)); } } From a6d9b42e5fa3912b3a559c7e2068e74d4927438a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 00:35:17 +0200 Subject: [PATCH 04/11] [ticket/13073] Rework route tests and add tests for more directory types PHPBB3-13073 --- .../helper_route_adm_subdir_test.php | 33 +++++++++ tests/controller/helper_route_adm_test.php | 45 +++--------- tests/controller/helper_route_test.php | 68 ++++++++++++------- .../helper_route_unclean_path_test.php | 33 +++++++++ 4 files changed, 121 insertions(+), 58 deletions(-) create mode 100644 tests/controller/helper_route_adm_subdir_test.php create mode 100644 tests/controller/helper_route_unclean_path_test.php diff --git a/tests/controller/helper_route_adm_subdir_test.php b/tests/controller/helper_route_adm_subdir_test.php new file mode 100644 index 0000000000..783797f86a --- /dev/null +++ b/tests/controller/helper_route_adm_subdir_test.php @@ -0,0 +1,33 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/helper_route_test.php'; + +class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test +{ + protected function get_phpbb_root_path() + { + return './../../'; + } + + protected function get_uri() + { + return '/adm/subdir/index.php'; + } + + protected function get_script_name() + { + return 'index.php'; + } +} diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php index ec7fc0c490..079f779dbf 100644 --- a/tests/controller/helper_route_adm_test.php +++ b/tests/controller/helper_route_adm_test.php @@ -14,45 +14,20 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/helper_route_test.php'; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test { - public function setUp() + protected function get_phpbb_root_path() { - global $phpbb_dispatcher, $phpbb_root_path, $phpEx; + return './../'; + } - parent::setUp(); + protected function get_uri() + { + return '/adm/index.php'; + } - $request = new phpbb_mock_request(); - $request->overwrite('SCRIPT_NAME', '/adm/index.php', \phpbb\request\request_interface::SERVER); - $request->overwrite('SCRIPT_FILENAME', 'index.php', \phpbb\request\request_interface::SERVER); - $request->overwrite('REQUEST_URI', '/adm/index.php', \phpbb\request\request_interface::SERVER); - $request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER); - $request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER); - - $this->symfony_request = new \phpbb\symfony_request( - $request - ); - $this->filesystem = new \phpbb\filesystem(); - $phpbb_path_helper = new \phpbb\path_helper( - $this->symfony_request, - $this->filesystem, - $this->getMock('\phpbb\request\request'), - $phpbb_root_path, - $phpEx - ); - - $finder = new \phpbb\finder( - new \phpbb\filesystem(), - dirname(__FILE__) . '/', - new phpbb_mock_cache() - ); - $finder->set_extensions(array_keys($this->extension_manager->all_enabled())); - $this->provider = new \phpbb\controller\provider(); - $this->provider->find_routing_files($finder); - $this->provider->find(dirname(__FILE__) . '/'); - // Set correct current phpBB root path - $this->root_path = './../'; + protected function get_script_name() + { + return 'index.php'; } } diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index 94e006166a..474230aa1c 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -23,29 +23,6 @@ class phpbb_controller_helper_route_test extends phpbb_test_case { global $phpbb_dispatcher, $phpbb_root_path, $phpEx; - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = new \phpbb\user('\phpbb\datetime'); - - $request = new phpbb_mock_request(); - $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER); - $request->overwrite('SCRIPT_FILENAME', 'app.php', \phpbb\request\request_interface::SERVER); - $request->overwrite('REQUEST_URI', '/app.php', \phpbb\request\request_interface::SERVER); - $request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER); - $request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER); - - $this->symfony_request = new \phpbb\symfony_request( - $request - ); - $this->filesystem = new \phpbb\filesystem(); - $phpbb_path_helper = new \phpbb\path_helper( - $this->symfony_request, - $this->filesystem, - $this->getMock('\phpbb\request\request'), - $phpbb_root_path, - $phpEx - ); - $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context()); $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( @@ -56,6 +33,49 @@ class phpbb_controller_helper_route_test extends phpbb_test_case ), ) ); + $this->generate_route_objects(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + $this->user = new \phpbb\user('\phpbb\datetime'); + + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context()); + } + + protected function get_phpbb_root_path() + { + return ''; + } + + protected function get_uri() + { + return '/app.php'; + } + + protected function get_script_name() + { + return 'app.php'; + } + + protected function generate_route_objects() + { + $request = new phpbb_mock_request(); + $request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER); + $request->overwrite('SCRIPT_FILENAME', $this->get_script_name(), \phpbb\request\request_interface::SERVER); + $request->overwrite('REQUEST_URI', $this->get_uri(), \phpbb\request\request_interface::SERVER); + $request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER); + $request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER); + + $this->symfony_request = new \phpbb\symfony_request( + $request + ); + $this->filesystem = new \phpbb\filesystem(); + $this->phpbb_path_helper = new \phpbb\path_helper( + $this->symfony_request, + $this->filesystem, + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + $phpEx + ); $finder = new \phpbb\finder( new \phpbb\filesystem(), @@ -66,6 +86,8 @@ class phpbb_controller_helper_route_test extends phpbb_test_case $this->provider = new \phpbb\controller\provider(); $this->provider->find_routing_files($finder); $this->provider->find(dirname(__FILE__) . '/'); + // Set correct current phpBB root path + $this->root_path = $this->get_phpbb_root_path(); } public function helper_url_data_no_rewrite() diff --git a/tests/controller/helper_route_unclean_path_test.php b/tests/controller/helper_route_unclean_path_test.php new file mode 100644 index 0000000000..697dda3c45 --- /dev/null +++ b/tests/controller/helper_route_unclean_path_test.php @@ -0,0 +1,33 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/helper_route_test.php'; + +class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test +{ + protected function get_phpbb_root_path() + { + return './../'; + } + + protected function get_uri() + { + return '/adm/../bertie/index.php'; + } + + protected function get_script_name() + { + return 'index.php'; + } +} From de7ed7c286968895169252ef477faffd1123a05b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 12:01:31 +0200 Subject: [PATCH 05/11] [ticket/13073] Use correct class names in test files PHPBB3-13073 --- tests/controller/helper_route_adm_subdir_test.php | 2 +- tests/controller/helper_route_unclean_path_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/controller/helper_route_adm_subdir_test.php b/tests/controller/helper_route_adm_subdir_test.php index 783797f86a..b173794f7a 100644 --- a/tests/controller/helper_route_adm_subdir_test.php +++ b/tests/controller/helper_route_adm_subdir_test.php @@ -14,7 +14,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/helper_route_test.php'; -class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test +class phpbb_controller_helper_route_adm_subdir_test extends phpbb_controller_helper_route_test { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_unclean_path_test.php b/tests/controller/helper_route_unclean_path_test.php index 697dda3c45..cede004717 100644 --- a/tests/controller/helper_route_unclean_path_test.php +++ b/tests/controller/helper_route_unclean_path_test.php @@ -14,7 +14,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/helper_route_test.php'; -class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test +class phpbb_controller_helper_route_unclean_path_test extends phpbb_controller_helper_route_test { protected function get_phpbb_root_path() { From eaef881e7d193f0f3fe4ce297091dd440d08e9b3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 12:03:04 +0200 Subject: [PATCH 06/11] [ticket/13073] Properly place comments in helper PHPBB3-13073 --- phpBB/phpbb/controller/helper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 5bca8edbaa..4b93cd505a 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -140,14 +140,13 @@ class helper // If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it. $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url); + // We need to update the base url to move to the directory of the app.php file if (empty($this->config['enable_mod_rewrite'])) { - // We need to update the base url to move to the directory of the app.php file. $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url); } else { - // We need to append the phpbb_root_path for proper routes $base_url .= preg_replace('#[\\/\\\]$#', '', preg_replace('#^\.#', '', $this->phpbb_root_path)); } From 4186ced4791cd8ea6c105d462f361be15eaff218 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 12:14:57 +0200 Subject: [PATCH 07/11] [ticket/13073] Use just one regex in helper route() PHPBB3-13073 --- phpBB/phpbb/controller/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 4b93cd505a..6c78868dbb 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -147,7 +147,7 @@ class helper } else { - $base_url .= preg_replace('#[\\/\\\]$#', '', preg_replace('#^\.#', '', $this->phpbb_root_path)); + $base_url .= preg_replace('#^(?:(\.))+(?:(.+)?)+(?:([\\/\\\])$)#', '$2', $this->phpbb_root_path); } $base_url = $this->filesystem->clean_path($base_url); From 6fd54436ee4568cd2e70d08063a816e3ce1ff4bc Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 13:50:56 +0200 Subject: [PATCH 08/11] [ticket/13073] Add path regex to get_preg_expression() and add unit tests We're now calling get_preg_expression() instead of hardcoding the regex into the helper route method. PHPBB3-13073 --- phpBB/includes/functions.php | 5 +++ phpBB/phpbb/controller/helper.php | 2 +- tests/functions/get_preg_expression_test.php | 38 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/functions/get_preg_expression_test.php diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a61518401c..9e1e1cae0e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3317,6 +3317,11 @@ function get_preg_expression($mode) case 'table_prefix': return '#^[a-zA-Z][a-zA-Z0-9_]*$#'; break; + + // Matches the predecing dot + case 'path_remove_dot_trailing_slash': + return '#^(?:(\.)?)+(?:(.+)?)+(?:([\\/\\\])$)#'; + break; } return ''; diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 6c78868dbb..fc19b855c0 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -147,7 +147,7 @@ class helper } else { - $base_url .= preg_replace('#^(?:(\.))+(?:(.+)?)+(?:([\\/\\\])$)#', '$2', $this->phpbb_root_path); + $base_url .= preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), '$2', $this->phpbb_root_path); } $base_url = $this->filesystem->clean_path($base_url); diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php new file mode 100644 index 0000000000..ed0f2b5685 --- /dev/null +++ b/tests/functions/get_preg_expression_test.php @@ -0,0 +1,38 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_functions_get_preg_expression_test extends phpbb_test_case +{ + public function data_path_remove_dot_trailing_slash() + { + return array( + array('/..', '$2', './../'), + array('/..', '$2', '/../'), + array('', '$2', ''), + array('', '$2', './'), + array('', '$2', '/'), + array('/../..', '$2', './../../'), + array('/../..', '$2', '/../../'), + ); + } + + /** + * @dataProvider data_path_remove_dot_trailing_slash + */ + public function test_path_remove_dot_trailing_slash($expected, $replace, $input) + { + $this->assertSame($expected, preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), $replace, $input)); + } +} From 543d68a7d37c750b629d96961139bb55a1a45a26 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 15:21:04 +0200 Subject: [PATCH 09/11] [ticket/13073] Use abstract class for controller helper route tests PHPBB3-13073 --- ..._test.php => common_helper_route_test.php} | 2 +- .../helper_route_adm_subdir_test.php | 4 +-- tests/controller/helper_route_adm_test.php | 4 +-- tests/controller/helper_route_root_test.php | 33 +++++++++++++++++++ .../helper_route_unclean_path_test.php | 4 +-- 5 files changed, 40 insertions(+), 7 deletions(-) rename tests/controller/{helper_route_test.php => common_helper_route_test.php} (99%) create mode 100644 tests/controller/helper_route_root_test.php diff --git a/tests/controller/helper_route_test.php b/tests/controller/common_helper_route_test.php similarity index 99% rename from tests/controller/helper_route_test.php rename to tests/controller/common_helper_route_test.php index 474230aa1c..7fc046879b 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/common_helper_route_test.php @@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -class phpbb_controller_helper_route_test extends phpbb_test_case +abstract class phpbb_controller_common_helper_route_test extends phpbb_test_case { protected $root_path; diff --git a/tests/controller/helper_route_adm_subdir_test.php b/tests/controller/helper_route_adm_subdir_test.php index b173794f7a..02ff687be0 100644 --- a/tests/controller/helper_route_adm_subdir_test.php +++ b/tests/controller/helper_route_adm_subdir_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route_test.php'; -class phpbb_controller_helper_route_adm_subdir_test extends phpbb_controller_helper_route_test +class phpbb_controller_helper_route_adm_subdir_test extends phpbb_controller_common_helper_route_test { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php index 079f779dbf..76cf4a2872 100644 --- a/tests/controller/helper_route_adm_test.php +++ b/tests/controller/helper_route_adm_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route_test.php'; -class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_route_test +class phpbb_controller_helper_route_adm_test extends phpbb_controller_common_helper_route_test { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_root_test.php b/tests/controller/helper_route_root_test.php new file mode 100644 index 0000000000..f3978d3e37 --- /dev/null +++ b/tests/controller/helper_route_root_test.php @@ -0,0 +1,33 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/common_helper_route_test.php'; + +class phpbb_controller_helper_route_test extends phpbb_controller_common_helper_route_test +{ + protected function get_phpbb_root_path() + { + return ''; + } + + protected function get_uri() + { + return '/app.php'; + } + + protected function get_script_name() + { + return 'app.php'; + } +} diff --git a/tests/controller/helper_route_unclean_path_test.php b/tests/controller/helper_route_unclean_path_test.php index cede004717..9a4c80937c 100644 --- a/tests/controller/helper_route_unclean_path_test.php +++ b/tests/controller/helper_route_unclean_path_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route_test.php'; -class phpbb_controller_helper_route_unclean_path_test extends phpbb_controller_helper_route_test +class phpbb_controller_helper_route_unclean_path_test extends phpbb_controller_common_helper_route_test { protected function get_phpbb_root_path() { From d720428564ee1982c3087a9433304d630c7d26af Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 15:30:24 +0200 Subject: [PATCH 10/11] [ticket/13073] Switch $input with $expected and add paths with letters PHPBB3-13073 --- tests/functions/get_preg_expression_test.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php index ed0f2b5685..e74017d315 100644 --- a/tests/functions/get_preg_expression_test.php +++ b/tests/functions/get_preg_expression_test.php @@ -18,20 +18,22 @@ class phpbb_functions_get_preg_expression_test extends phpbb_test_case public function data_path_remove_dot_trailing_slash() { return array( - array('/..', '$2', './../'), - array('/..', '$2', '/../'), + array('./../', '$2', '/..'), + array('/../', '$2', '/..'), array('', '$2', ''), - array('', '$2', './'), - array('', '$2', '/'), - array('/../..', '$2', './../../'), - array('/../..', '$2', '/../../'), + array('./', '$2', ''), + array('/', '$2', ''), + array('./../../', '$2', '/../..'), + array('/../../', '$2', '/../..'), + array('./dir/', '$2', '/dir'), + array('./../dir/', '$2', '/../dir'), ); } /** * @dataProvider data_path_remove_dot_trailing_slash */ - public function test_path_remove_dot_trailing_slash($expected, $replace, $input) + public function test_path_remove_dot_trailing_slash($input, $replace, $expected) { $this->assertSame($expected, preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), $replace, $input)); } From 3418683cfcfd99235c680e28c60f066c3b36915a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 19 Sep 2014 16:50:26 +0200 Subject: [PATCH 11/11] [ticket/13073] Remove _test suffix from common test class PHPBB3-13073 --- .../{common_helper_route_test.php => common_helper_route.php} | 2 +- tests/controller/helper_route_adm_subdir_test.php | 4 ++-- tests/controller/helper_route_adm_test.php | 4 ++-- tests/controller/helper_route_root_test.php | 4 ++-- tests/controller/helper_route_unclean_path_test.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) rename tests/controller/{common_helper_route_test.php => common_helper_route.php} (99%) diff --git a/tests/controller/common_helper_route_test.php b/tests/controller/common_helper_route.php similarity index 99% rename from tests/controller/common_helper_route_test.php rename to tests/controller/common_helper_route.php index 7fc046879b..1751578a75 100644 --- a/tests/controller/common_helper_route_test.php +++ b/tests/controller/common_helper_route.php @@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -abstract class phpbb_controller_common_helper_route_test extends phpbb_test_case +abstract class phpbb_controller_common_helper_route extends phpbb_test_case { protected $root_path; diff --git a/tests/controller/helper_route_adm_subdir_test.php b/tests/controller/helper_route_adm_subdir_test.php index 02ff687be0..f27ac81b04 100644 --- a/tests/controller/helper_route_adm_subdir_test.php +++ b/tests/controller/helper_route_adm_subdir_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/common_helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; -class phpbb_controller_helper_route_adm_subdir_test extends phpbb_controller_common_helper_route_test +class phpbb_controller_helper_route_adm_subdir_test extends phpbb_controller_common_helper_route { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php index 76cf4a2872..86dc36ef1f 100644 --- a/tests/controller/helper_route_adm_test.php +++ b/tests/controller/helper_route_adm_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/common_helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; -class phpbb_controller_helper_route_adm_test extends phpbb_controller_common_helper_route_test +class phpbb_controller_helper_route_adm_test extends phpbb_controller_common_helper_route { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_root_test.php b/tests/controller/helper_route_root_test.php index f3978d3e37..63a2f2f8f7 100644 --- a/tests/controller/helper_route_root_test.php +++ b/tests/controller/helper_route_root_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/common_helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; -class phpbb_controller_helper_route_test extends phpbb_controller_common_helper_route_test +class phpbb_controller_helper_route_test extends phpbb_controller_common_helper_route { protected function get_phpbb_root_path() { diff --git a/tests/controller/helper_route_unclean_path_test.php b/tests/controller/helper_route_unclean_path_test.php index 9a4c80937c..9d8b62bc1c 100644 --- a/tests/controller/helper_route_unclean_path_test.php +++ b/tests/controller/helper_route_unclean_path_test.php @@ -12,9 +12,9 @@ */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/common_helper_route_test.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; -class phpbb_controller_helper_route_unclean_path_test extends phpbb_controller_common_helper_route_test +class phpbb_controller_helper_route_unclean_path_test extends phpbb_controller_common_helper_route { protected function get_phpbb_root_path() {