MediaWiki REL1_31
wfRemoveDotSegmentsTest.php
Go to the documentation of this file.
1<?php
2
11 public function testWfRemoveDotSegments( $inputPath, $outputPath ) {
12 $this->assertEquals(
13 $outputPath,
14 wfRemoveDotSegments( $inputPath ),
15 "Testing $inputPath expands to $outputPath"
16 );
17 }
18
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/' ],
91 ];
92 }
93}
wfRemoveDotSegments( $urlPath)
Remove all dot-segments in the provided URL path.
GlobalFunctions wfRemoveDotSegments.
testWfRemoveDotSegments( $inputPath, $outputPath)
providePaths
static providePaths()
Provider of URL paths for testing wfRemoveDotSegments()