Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / wfRemoveDotSegmentsTest.php
blobeae5588b942e34cd407bc673fc72514642fcabf9
1 <?php
3 /**
4 * @group GlobalFunctions
5 * @covers ::wfRemoveDotSegments
6 */
7 class WfRemoveDotSegmentsTest extends MediaWikiTestCase {
8 /**
9 * @dataProvider providePaths
11 public function testWfRemoveDotSegments( $inputPath, $outputPath ) {
12 $this->assertEquals(
13 $outputPath,
14 wfRemoveDotSegments( $inputPath ),
15 "Testing $inputPath expands to $outputPath"
19 /**
20 * Provider of URL paths for testing wfRemoveDotSegments()
22 * @return array
24 public static function providePaths() {
25 return [
26 [ '/a/b/c/./../../g', '/a/g' ],
27 [ 'mid/content=5/../6', 'mid/6' ],
28 [ '/a//../b', '/a/b' ],
29 [ '/.../a', '/.../a' ],
30 [ '.../a', '.../a' ],
31 [ '', '' ],
32 [ '/', '/' ],
33 [ '//', '//' ],
34 [ '.', '' ],
35 [ '..', '' ],
36 [ '...', '...' ],
37 [ '/.', '/' ],
38 [ '/..', '/' ],
39 [ './', '' ],
40 [ '../', '' ],
41 [ './a', 'a' ],
42 [ '../a', 'a' ],
43 [ '../../a', 'a' ],
44 [ '.././a', 'a' ],
45 [ './../a', 'a' ],
46 [ '././a', 'a' ],
47 [ '../../', '' ],
48 [ '.././', '' ],
49 [ './../', '' ],
50 [ '././', '' ],
51 [ '../..', '' ],
52 [ '../.', '' ],
53 [ './..', '' ],
54 [ './.', '' ],
55 [ '/../../a', '/a' ],
56 [ '/.././a', '/a' ],
57 [ '/./../a', '/a' ],
58 [ '/././a', '/a' ],
59 [ '/../../', '/' ],
60 [ '/.././', '/' ],
61 [ '/./../', '/' ],
62 [ '/././', '/' ],
63 [ '/../..', '/' ],
64 [ '/../.', '/' ],
65 [ '/./..', '/' ],
66 [ '/./.', '/' ],
67 [ 'b/../../a', '/a' ],
68 [ 'b/.././a', '/a' ],
69 [ 'b/./../a', '/a' ],
70 [ 'b/././a', 'b/a' ],
71 [ 'b/../../', '/' ],
72 [ 'b/.././', '/' ],
73 [ 'b/./../', '/' ],
74 [ 'b/././', 'b/' ],
75 [ 'b/../..', '/' ],
76 [ 'b/../.', '/' ],
77 [ 'b/./..', '/' ],
78 [ 'b/./.', 'b/' ],
79 [ '/b/../../a', '/a' ],
80 [ '/b/.././a', '/a' ],
81 [ '/b/./../a', '/a' ],
82 [ '/b/././a', '/b/a' ],
83 [ '/b/../../', '/' ],
84 [ '/b/.././', '/' ],
85 [ '/b/./../', '/' ],
86 [ '/b/././', '/b/' ],
87 [ '/b/../..', '/' ],
88 [ '/b/../.', '/' ],
89 [ '/b/./..', '/' ],
90 [ '/b/./.', '/b/' ],