xref: /plugin/davcal/vendor/sabre/uri/tests/NormalizeTest.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\Uri;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehlerclass NormalizeTest extends \PHPUnit_Framework_TestCase{
6*a1a3b679SAndreas Boehler
7*a1a3b679SAndreas Boehler    /**
8*a1a3b679SAndreas Boehler     * @dataProvider normalizeData
9*a1a3b679SAndreas Boehler     */
10*a1a3b679SAndreas Boehler    function testNormalize($in, $out) {
11*a1a3b679SAndreas Boehler
12*a1a3b679SAndreas Boehler        $this->assertEquals(
13*a1a3b679SAndreas Boehler            $out,
14*a1a3b679SAndreas Boehler            normalize($in)
15*a1a3b679SAndreas Boehler        );
16*a1a3b679SAndreas Boehler
17*a1a3b679SAndreas Boehler    }
18*a1a3b679SAndreas Boehler
19*a1a3b679SAndreas Boehler    function normalizeData() {
20*a1a3b679SAndreas Boehler
21*a1a3b679SAndreas Boehler        return [
22*a1a3b679SAndreas Boehler            [ 'http://example.org/',             'http://example.org/' ],
23*a1a3b679SAndreas Boehler            [ 'HTTP://www.EXAMPLE.com/',         'http://www.example.com/'],
24*a1a3b679SAndreas Boehler            [ 'http://example.org/%7Eevert',     'http://example.org/~evert'],
25*a1a3b679SAndreas Boehler            [ 'http://example.org/./evert',      'http://example.org/evert'],
26*a1a3b679SAndreas Boehler            [ 'http://example.org/../evert',     'http://example.org/evert'],
27*a1a3b679SAndreas Boehler            [ 'http://example.org/foo/../evert', 'http://example.org/evert'],
28*a1a3b679SAndreas Boehler            [ '/%41',                            '/A'],
29*a1a3b679SAndreas Boehler            [ '/%3F',                            '/%3F'],
30*a1a3b679SAndreas Boehler            [ '/%3f',                            '/%3F'],
31*a1a3b679SAndreas Boehler            [ 'http://example.org',              'http://example.org/'],
32*a1a3b679SAndreas Boehler            [ 'http://example.org:/',            'http://example.org/'],
33*a1a3b679SAndreas Boehler            [ 'http://example.org:80/',          'http://example.org/'],
34*a1a3b679SAndreas Boehler
35*a1a3b679SAndreas Boehler        ];
36*a1a3b679SAndreas Boehler
37*a1a3b679SAndreas Boehler    }
38*a1a3b679SAndreas Boehler
39*a1a3b679SAndreas Boehler}
40