diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-09-19 18:58:53 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-09-19 18:58:53 +0200 |
commit | fc252f1ba52760a072d8e79f5afc3268db7d1035 (patch) | |
tree | a2f4b15262c615d16ea398dd69ce16b6788c53f5 /tests/functions/get_preg_expression_test.php | |
parent | 98f02ece97cd92de6f71632247a439a1ba25a408 (diff) | |
parent | 3418683cfcfd99235c680e28c60f066c3b36915a (diff) | |
download | forums-fc252f1ba52760a072d8e79f5afc3268db7d1035.tar forums-fc252f1ba52760a072d8e79f5afc3268db7d1035.tar.gz forums-fc252f1ba52760a072d8e79f5afc3268db7d1035.tar.bz2 forums-fc252f1ba52760a072d8e79f5afc3268db7d1035.tar.xz forums-fc252f1ba52760a072d8e79f5afc3268db7d1035.zip |
Merge pull request #2969 from marc1706/ticket/13073
[ticket/13073] Correctly generate routes from subfolders like /adm
* marc1706/ticket/13073:
[ticket/13073] Remove _test suffix from common test class
[ticket/13073] Switch $input with $expected and add paths with letters
[ticket/13073] Use abstract class for controller helper route tests
[ticket/13073] Add path regex to get_preg_expression() and add unit tests
[ticket/13073] Use just one regex in helper route()
[ticket/13073] Properly place comments in helper
[ticket/13073] Use correct class names in test files
[ticket/13073] Rework route tests and add tests for more directory types
[ticket/13073] Test that routes from subfolders like /adm work
[ticket/13073] Add tests for routes from adm pages
[ticket/13073] Add phpbb root path with mod rewrite enabled for proper routes
Diffstat (limited to 'tests/functions/get_preg_expression_test.php')
-rw-r--r-- | tests/functions/get_preg_expression_test.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php new file mode 100644 index 0000000000..e74017d315 --- /dev/null +++ b/tests/functions/get_preg_expression_test.php @@ -0,0 +1,40 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_functions_get_preg_expression_test extends phpbb_test_case +{ + public function data_path_remove_dot_trailing_slash() + { + return array( + array('./../', '$2', '/..'), + array('/../', '$2', '/..'), + array('', '$2', ''), + array('./', '$2', ''), + array('/', '$2', ''), + array('./../../', '$2', '/../..'), + array('/../../', '$2', '/../..'), + array('./dir/', '$2', '/dir'), + array('./../dir/', '$2', '/../dir'), + ); + } + + /** + * @dataProvider data_path_remove_dot_trailing_slash + */ + public function test_path_remove_dot_trailing_slash($input, $replace, $expected) + { + $this->assertSame($expected, preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), $replace, $input)); + } +} |