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