diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-08 11:17:10 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-06-29 20:54:43 +0200 |
commit | 8feb383468cf0dc514a442c3cd03e101b9228799 (patch) | |
tree | bc0295658c0c45a420c954c63008c06b93728d15 /tests/path_helper/path_helper_test.php | |
parent | b7e1959d56a3334f730e5d0fd4194f5e4d0597a3 (diff) | |
download | forums-8feb383468cf0dc514a442c3cd03e101b9228799.tar forums-8feb383468cf0dc514a442c3cd03e101b9228799.tar.gz forums-8feb383468cf0dc514a442c3cd03e101b9228799.tar.bz2 forums-8feb383468cf0dc514a442c3cd03e101b9228799.tar.xz forums-8feb383468cf0dc514a442c3cd03e101b9228799.zip |
[ticket/12099] Add unit tests for get_web_root_path_from_ajax_referer()
PHPBB3-12099
Diffstat (limited to 'tests/path_helper/path_helper_test.php')
-rw-r--r-- | tests/path_helper/path_helper_test.php | 54 |
1 files changed, 54 insertions, 0 deletions
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)); + } } |