aboutsummaryrefslogtreecommitdiffstats
path: root/tests/path_helper
diff options
context:
space:
mode:
Diffstat (limited to 'tests/path_helper')
-rw-r--r--tests/path_helper/path_helper_test.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php
index bb68f8b3bc..73f0e6bafc 100644
--- a/tests/path_helper/path_helper_test.php
+++ b/tests/path_helper/path_helper_test.php
@@ -436,4 +436,29 @@ class phpbb_path_helper_test extends phpbb_test_case
{
$this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url));
}
+
+ public function data_get_valid_page()
+ {
+ return array(
+ // array( current page , mod_rewrite setting , expected output )
+ array('index', true, 'index'),
+ array('index', false, 'index'),
+ array('foo/index', true, 'foo/index'),
+ array('foo/index', false, 'foo/index'),
+ array('app.php/foo', true, 'foo'),
+ array('app.php/foo', false, 'app.php/foo'),
+ array('/../app.php/foo', true, '../foo'),
+ array('/../app.php/foo', false, '../app.php/foo'),
+ array('/../example/app.php/foo/bar', true, '../example/foo/bar'),
+ array('/../example/app.php/foo/bar', false, '../example/app.php/foo/bar'),
+ );
+ }
+
+ /**
+ * @dataProvider data_get_valid_page
+ */
+ public function test_get_valid_page($page, $mod_rewrite, $expected)
+ {
+ $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_valid_page($page, $mod_rewrite));
+ }
}