aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-08 11:17:10 +0200
committerTristan Darricau <github@nicofuma.fr>2014-06-29 20:54:43 +0200
commit8feb383468cf0dc514a442c3cd03e101b9228799 (patch)
treebc0295658c0c45a420c954c63008c06b93728d15 /tests/path_helper
parent[ticket/12099] Remove config again (diff)
downloadphpbb-8feb383468cf0dc514a442c3cd03e101b9228799.tar.gz
phpbb-8feb383468cf0dc514a442c3cd03e101b9228799.tar.bz2
phpbb-8feb383468cf0dc514a442c3cd03e101b9228799.zip
[ticket/12099] Add unit tests for get_web_root_path_from_ajax_referer()
PHPBB3-12099
Diffstat (limited to 'tests/path_helper')
-rw-r--r--tests/path_helper/path_helper_test.php54
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));
+ }
}