diff options
author | Tristan Darricau <github@nicofuma.fr> | 2015-01-19 16:45:43 +0100 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2015-01-19 16:45:43 +0100 |
commit | add3d3e76001c6f0355da37355b0ff89cc8b8f04 (patch) | |
tree | 3e610ccbf1a29cda264941dab36097e69a4d8faf /tests/path_helper | |
parent | 9d2c6b6ed6387da32eb821fbbab39559f0e67c01 (diff) | |
parent | da189a105b41736f9e47c2f560f242d7844f9b43 (diff) | |
download | forums-add3d3e76001c6f0355da37355b0ff89cc8b8f04.tar forums-add3d3e76001c6f0355da37355b0ff89cc8b8f04.tar.gz forums-add3d3e76001c6f0355da37355b0ff89cc8b8f04.tar.bz2 forums-add3d3e76001c6f0355da37355b0ff89cc8b8f04.tar.xz forums-add3d3e76001c6f0355da37355b0ff89cc8b8f04.zip |
Merge pull request #3055 from marc1706/ticket/13192
[ticket/13192] Add method for generating valid user page links based on mod_rewrite
* marc1706/ticket/13192:
[ticket/13192] Add test for app.php in external subfolder
[ticket/13192] Use ltrim() instead of preg_replace()
[ticket/13192] Order test cases consistently
[ticket/13192] Remove app.php on mod rewrite even if app.php is outside root
[ticket/13192] Pass correct parameters and rename method to get_valid_page
[ticket/13192] Use get_valid_user_page in confirm_box() and cleanup globals
[ticket/13192] Use get_valid_user_page method in build_url function
[ticket/13192] Add method for generating valid user page links
Diffstat (limited to 'tests/path_helper')
-rw-r--r-- | tests/path_helper/path_helper_test.php | 25 |
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)); + } } |