From f383d4221ce085dc36ef4c04a0a2c7c3f381b108 Mon Sep 17 00:00:00 2001 From: Pico88 Date: Mon, 21 Apr 2014 19:53:46 +0200 Subject: [ticket/12099] Add request argument to path_helper service PHPBB3-12099 --- tests/avatar/manager_test.php | 2 ++ tests/controller/helper_route_test.php | 2 ++ tests/extension/metadata_manager_test.php | 2 ++ tests/path_helper/path_helper_test.php | 4 ++++ tests/security/redirect_test.php | 2 ++ tests/template/template_events_test.php | 2 ++ tests/template/template_test_case.php | 2 ++ tests/template/template_test_case_with_tree.php | 2 ++ tests/test_framework/phpbb_session_test_case.php | 2 ++ 9 files changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 246397ad6c..96d3ba1474 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -38,6 +38,8 @@ class phpbb_avatar_manager_test extends \phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + $config, $phpbb_root_path, $phpEx ); diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index 621efaa830..a9e8e46a42 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -26,6 +26,8 @@ class phpbb_controller_helper_route_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 3678ac0a3f..b7f309b2a9 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -50,6 +50,8 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $this->phpbb_root_path, $this->phpEx ), diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 9866cb6efe..e7e2ae697f 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -29,6 +29,8 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $this->phpbb_root_path, 'php' ); @@ -158,6 +160,8 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $this->phpbb_root_path, 'php' ); diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index fb1011cde0..24c42ca8c2 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -63,6 +63,8 @@ class phpbb_security_redirect_test extends phpbb_security_test_base new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $this->phpbb_root_path, 'php' ); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index ce3c90b78a..2c29d42173 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -143,6 +143,8 @@ Zeta test event in all', new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 00b823b2c4..d393027566 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -72,6 +72,8 @@ class phpbb_template_template_test_case extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 4f778a9c1c..c1b22e94e0 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -27,6 +27,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index 8a5d582573..144e05b5fa 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -32,6 +32,8 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $phpbb_path_helper = new \phpbb\path_helper( $symfony_request, $phpbb_filesystem, + $this->getMock('\phpbb\request\request'), + new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); -- cgit v1.2.1 From b7e1959d56a3334f730e5d0fd4194f5e4d0597a3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 7 May 2014 23:22:53 +0200 Subject: [ticket/12099] Remove config again PHPBB3-12099 --- tests/avatar/manager_test.php | 1 - tests/controller/helper_route_test.php | 1 - tests/extension/metadata_manager_test.php | 1 - tests/functions/build_url_test.php | 3 ++- tests/path_helper/path_helper_test.php | 2 -- tests/security/redirect_test.php | 1 - tests/template/template_events_test.php | 1 - tests/template/template_test_case.php | 1 - tests/template/template_test_case_with_tree.php | 1 - tests/test_framework/phpbb_session_test_case.php | 1 - 10 files changed, 2 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 96d3ba1474..de505e2c9f 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -39,7 +39,6 @@ class phpbb_avatar_manager_test extends \phpbb_test_case ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - $config, $phpbb_root_path, $phpEx ); diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index a9e8e46a42..206c3a4f0b 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -27,7 +27,6 @@ class phpbb_controller_helper_route_test extends phpbb_test_case ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index b7f309b2a9..bf7031454e 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -51,7 +51,6 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $this->phpbb_root_path, $this->phpEx ), diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 7a70bddc71..06415a424e 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -30,10 +30,11 @@ class phpbb_build_url_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, 'php' ); - $phpbb_container->set('path_helper', $path_helper); + $phpbb_container->set('path_helper', $phpbb_path_helper); } public function build_url_test_data() { diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index e7e2ae697f..3990f3abd5 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -30,7 +30,6 @@ class phpbb_path_helper_test extends phpbb_test_case ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $this->phpbb_root_path, 'php' ); @@ -161,7 +160,6 @@ class phpbb_path_helper_test extends phpbb_test_case $symfony_request, new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $this->phpbb_root_path, 'php' ); diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 24c42ca8c2..3961c2781e 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -64,7 +64,6 @@ class phpbb_security_redirect_test extends phpbb_security_test_base ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $this->phpbb_root_path, 'php' ); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 2c29d42173..c415c969fe 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -144,7 +144,6 @@ Zeta test event in all', ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index d393027566..83446b5352 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -73,7 +73,6 @@ class phpbb_template_template_test_case extends phpbb_test_case ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index c1b22e94e0..68ecc4b706 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -28,7 +28,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat ), new \phpbb\filesystem(), $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index 144e05b5fa..d4fc174a12 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -33,7 +33,6 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $symfony_request, $phpbb_filesystem, $this->getMock('\phpbb\request\request'), - new \phpbb\config\config(array()), $phpbb_root_path, $phpEx ); -- cgit v1.2.1 From 8feb383468cf0dc514a442c3cd03e101b9228799 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 8 May 2014 11:17:10 +0200 Subject: [ticket/12099] Add unit tests for get_web_root_path_from_ajax_referer() PHPBB3-12099 --- tests/path_helper/path_helper_test.php | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'tests') diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 3990f3abd5..27e94d6a07 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -340,4 +340,58 @@ class phpbb_path_helper_test extends phpbb_test_case { $this->assertEquals($expected, $this->path_helper->append_url_params($url, $params, $is_amp)); } + + public function get_web_root_path_from_ajax_referer_data() + { + return array( + array( + 'http://www.phpbb.com/community/route1/route2/', + 'http://www.phpbb.com/community', + '../../', + ), + array( + 'http://www.phpbb.com/community/route1/route2', + 'http://www.phpbb.com/community', + '../', + ), + array( + 'http://www.phpbb.com/community/route1', + 'http://www.phpbb.com/community', + '', + ), + array( + 'http://www.phpbb.com/community/', + 'http://www.phpbb.com/community', + '', + ), + array( + 'http://www.phpbb.com/notcommunity/route1/route2/', + 'http://www.phpbb.com/community', + '../../../community/', + ), + array( + 'http://www.phpbb.com/notcommunity/route1/route2', + 'http://www.phpbb.com/community', + '../../community/', + ), + array( + 'http://www.phpbb.com/notcommunity/route1', + 'http://www.phpbb.com/community', + '../community/', + ), + array( + 'http://www.phpbb.com/notcommunity/', + 'http://www.phpbb.com/community', + '../community/', + ), + ); + } + + /** + * @dataProvider get_web_root_path_from_ajax_referer_data + */ + public function test_get_web_root_path_from_ajax_referer($referer_url, $board_url, $expected) + { + $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url)); + } } -- cgit v1.2.1 From b4d7192b62c98b0738711a7b7647a47129adb902 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 8 Jul 2014 00:20:33 +0200 Subject: [ticket/12787] Updates phpbb_mock_controller_helper PHPBB3-12787 --- tests/mock/controller_helper.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php index 9f70f8e96c..f9d231258e 100644 --- a/tests/mock/controller_helper.php +++ b/tests/mock/controller_helper.php @@ -23,4 +23,9 @@ class phpbb_mock_controller_helper extends \phpbb\controller\helper $provider->find_routing_files($manager->get_finder()); $this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); } + + public function get_current_url() + { + return ''; + } } -- cgit v1.2.1