mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 01:06:48 +02:00
Merge pull request #2676 from Nicofuma/ticket/12787
[ticket/12787] Allow the route to say that the referer has to be used. * Nicofuma/ticket/12787: [ticket/12787] Updates phpbb_mock_controller_helper [ticket/12787] Add controller_helper::get_current_url() [ticket/12787] Remove one app.php when it's both in $path and $web_root_path [ticket/12787] Fix the absolute board url [ticket/12787] Use a parameter (_referer) instead of the Referer header [ticket/12099] Add unit tests for get_web_root_path_from_ajax_referer() [ticket/12099] Remove config again [ticket/12099] Correctly fix the path when performing AJAX requests [ticket/12099] Add request argument to path_helper service
This commit is contained in:
@@ -38,6 +38,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
@@ -26,6 +26,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
@@ -53,6 +53,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$this->phpbb_root_path,
|
||||
$this->phpEx
|
||||
),
|
||||
|
@@ -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()
|
||||
{
|
||||
|
@@ -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 '';
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ class phpbb_path_helper_test extends phpbb_test_case
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$this->phpbb_root_path,
|
||||
'php'
|
||||
);
|
||||
@@ -158,6 +159,7 @@ 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'),
|
||||
$this->phpbb_root_path,
|
||||
'php'
|
||||
);
|
||||
@@ -338,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));
|
||||
}
|
||||
}
|
||||
|
@@ -63,6 +63,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$this->phpbb_root_path,
|
||||
'php'
|
||||
);
|
||||
|
@@ -143,6 +143,7 @@ Zeta test event in all',
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
@@ -72,6 +72,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
@@ -27,6 +27,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||
new phpbb_mock_request()
|
||||
),
|
||||
new \phpbb\filesystem(),
|
||||
$this->getMock('\phpbb\request\request'),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
@@ -32,6 +32,7 @@ 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'),
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
|
Reference in New Issue
Block a user