ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ResolveTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\Uri;
4 
6 
10  function testResolve($base, $update, $expected) {
11 
12  $this->assertEquals(
13  $expected,
14  resolve($base, $update)
15  );
16 
17  }
18 
19  function resolveData() {
20 
21  return [
22  [
23  'http://example.org/foo/baz',
24  '/bar',
25  'http://example.org/bar',
26  ],
27  [
28  'https://example.org/foo',
29  '//example.net/',
30  'https://example.net/',
31  ],
32  [
33  'https://example.org/foo',
34  '?a=b',
35  'https://example.org/foo?a=b',
36  ],
37  [
38  '//example.org/foo',
39  '?a=b',
40  '//example.org/foo?a=b',
41  ],
42  // Ports and fragments
43  [
44  'https://example.org:81/foo#hey',
45  '?a=b#c=d',
46  'https://example.org:81/foo?a=b#c=d',
47  ],
48  // Relative.. in-directory paths
49  [
50  'http://example.org/foo/bar',
51  'bar2',
52  'http://example.org/foo/bar2',
53  ],
54  // Now the base path ended with a slash
55  [
56  'http://example.org/foo/bar/',
57  'bar2/bar3',
58  'http://example.org/foo/bar/bar2/bar3',
59  ],
60  // .. and .
61  [
62  'http://example.org/foo/bar/',
63  '../bar2/.././/bar3/',
64  'http://example.org/foo//bar3/',
65  ],
66  // Only updating the fragment
67  [
68  'https://example.org/foo?a=b',
69  '#comments',
70  'https://example.org/foo?a=b#comments',
71  ],
72  // Switching to mailto!
73  [
74  'https://example.org/foo?a=b',
75  'mailto:foo@example.org',
76  'mailto:foo@example.org',
77  ],
78  // Resolving empty path
79  [
80  'http://www.example.org',
81  '#foo',
82  'http://www.example.org/#foo',
83  ],
84  // Another fragment test
85  [
86  'http://example.org/path.json',
87  '#',
88  'http://example.org/path.json',
89  ],
90  [
91  'http://www.example.com',
92  '#',
93  'http://www.example.com/',
94  ]
95  ];
96 
97  }
98 
99 }
resolve($basePath, $newPath)
This file contains all the uri handling functions.
Definition: functions.php:23
$base
Definition: index.php:4
testResolve($base, $update, $expected)
resolveData
Definition: ResolveTest.php:10