ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SplitTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\Uri;
4 
6 
7  function testSplit() {
8 
9  $strings = [
10 
11  // input // expected result
12  '/foo/bar' => ['/foo','bar'],
13  '/foo/bar/' => ['/foo','bar'],
14  'foo/bar/' => ['foo','bar'],
15  'foo/bar' => ['foo','bar'],
16  'foo/bar/baz' => ['foo/bar','baz'],
17  'foo/bar/baz/' => ['foo/bar','baz'],
18  'foo' => ['','foo'],
19  'foo/' => ['','foo'],
20  '/foo/' => ['','foo'],
21  '/foo' => ['','foo'],
22  '' => [null,null],
23 
24  // UTF-8
25  "/\xC3\xA0fo\xC3\xB3/bar" => ["/\xC3\xA0fo\xC3\xB3",'bar'],
26  "/\xC3\xA0foo/b\xC3\xBCr/" => ["/\xC3\xA0foo","b\xC3\xBCr"],
27  "foo/\xC3\xA0\xC3\xBCr" => ["foo","\xC3\xA0\xC3\xBCr"],
28 
29  ];
30 
31  foreach ($strings as $input => $expected) {
32 
33  $output = split($input);
34  $this->assertEquals($expected, $output, 'The expected output for \'' . $input . '\' was incorrect');
35 
36 
37  }
38 
39  }
40 
41 }
split($path)
Returns the &#39;dirname&#39; and &#39;basename&#39; for a path.
Definition: functions.php:279