1<?php 2 3namespace Sabre\Uri; 4 5class SplitTest extends \PHPUnit_Framework_TestCase{ 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} 42