1<?php 2 3namespace Sabre\Uri; 4 5class BuildTest extends \PHPUnit_Framework_TestCase{ 6 7 /** 8 * @dataProvider buildUriData 9 */ 10 function testBuild($value) { 11 12 $this->assertEquals( 13 $value, 14 build(parse_url($value)) 15 ); 16 17 } 18 19 function buildUriData() { 20 21 return [ 22 ['http://example.org/'], 23 ['http://example.org/foo/bar'], 24 ['//example.org/foo/bar'], 25 ['/foo/bar'], 26 ['http://example.org:81/'], 27 ['http://user@example.org:81/'], 28 ['http://example.org:81/hi?a=b'], 29 ['http://example.org:81/hi?a=b#c=d'], 30 // [ '//example.org:81/hi?a=b#c=d'], // Currently fails due to a 31 // PHP bug. 32 ['/hi?a=b#c=d'], 33 ['?a=b#c=d'], 34 ['#c=d'], 35 ['file:///etc/hosts'], 36 ['file://localhost/etc/hosts'], 37 ]; 38 39 } 40 41} 42