Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
8.33% |
1 / 12 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functions_get_preg_expression_test | |
8.33% |
1 / 12 |
|
50.00% |
1 / 2 |
5.08 | |
0.00% |
0 / 1 |
| data_path_remove_dot_trailing_slash | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| test_path_remove_dot_trailing_slash | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | class phpbb_functions_get_preg_expression_test extends phpbb_test_case |
| 15 | { |
| 16 | public static function data_path_remove_dot_trailing_slash() |
| 17 | { |
| 18 | return array( |
| 19 | array('./../', '$2', '/..'), |
| 20 | array('/../', '$2', '/..'), |
| 21 | array('', '$2', ''), |
| 22 | array('./', '$2', ''), |
| 23 | array('/', '$2', ''), |
| 24 | array('./../../', '$2', '/../..'), |
| 25 | array('/../../', '$2', '/../..'), |
| 26 | array('./dir/', '$2', '/dir'), |
| 27 | array('./../dir/', '$2', '/../dir'), |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * @dataProvider data_path_remove_dot_trailing_slash |
| 33 | */ |
| 34 | public function test_path_remove_dot_trailing_slash($input, $replace, $expected) |
| 35 | { |
| 36 | $this->assertSame($expected, preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), $replace, $input)); |
| 37 | } |
| 38 | } |