3 * Tests for wfRemoveDotSegments()
5 class WfRemoveDotSegmentsTest
extends MediaWikiTestCase
{
6 /** @dataProvider providePaths */
7 public function testWfRemoveDotSegments( $inputPath, $outputPath ) {
10 wfRemoveDotSegments( $inputPath ),
11 "Testing $inputPath expands to $outputPath"
16 * Provider of URL paths for testing wfRemoveDotSegments()
20 public static function providePaths() {
22 array( '/a/b/c/./../../g', '/a/g' ),
23 array( 'mid/content=5/../6', 'mid/6' ),
24 array( '/a//../b', '/a/b' ),
25 array( '/.../a', '/.../a' ),
26 array( '.../a', '.../a' ),
32 array( '...', '...' ),
39 array( '../../a', 'a' ),
40 array( '.././a', 'a' ),
41 array( './../a', 'a' ),
42 array( '././a', 'a' ),
43 array( '../../', '' ),
51 array( '/../../a', '/a' ),
52 array( '/.././a', '/a' ),
53 array( '/./../a', '/a' ),
54 array( '/././a', '/a' ),
55 array( '/../../', '/' ),
56 array( '/.././', '/' ),
57 array( '/./../', '/' ),
58 array( '/././', '/' ),
59 array( '/../..', '/' ),
60 array( '/../.', '/' ),
61 array( '/./..', '/' ),
63 array( 'b/../../a', '/a' ),
64 array( 'b/.././a', '/a' ),
65 array( 'b/./../a', '/a' ),
66 array( 'b/././a', 'b/a' ),
67 array( 'b/../../', '/' ),
68 array( 'b/.././', '/' ),
69 array( 'b/./../', '/' ),
70 array( 'b/././', 'b/' ),
71 array( 'b/../..', '/' ),
72 array( 'b/../.', '/' ),
73 array( 'b/./..', '/' ),
74 array( 'b/./.', 'b/' ),
75 array( '/b/../../a', '/a' ),
76 array( '/b/.././a', '/a' ),
77 array( '/b/./../a', '/a' ),
78 array( '/b/././a', '/b/a' ),
79 array( '/b/../../', '/' ),
80 array( '/b/.././', '/' ),
81 array( '/b/./../', '/' ),
82 array( '/b/././', '/b/' ),
83 array( '/b/../..', '/' ),
84 array( '/b/../.', '/' ),
85 array( '/b/./..', '/' ),
86 array( '/b/./.', '/b/' ),