Completed
Push — issue#666 ( 5e6b12...7229dc )
by Guilherme
09:55
created

HttpUriTest::testValidSimpleUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\RemoteClaimsBundle\Tests\Model;
12
13
use LoginCidadao\RemoteClaimsBundle\Model\HttpUri;
14
15
class HttpUriTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testValidCompleteUri()
18
    {
19
        $uri = 'https://user:[email protected]:8042/over/there?name=ferret#nose';
20
        $http = HttpUri::createFromString($uri);
21
22
        $this->assertInstanceOf('LoginCidadao\RemoteClaimsBundle\Model\HttpUri', $http);
23
        $this->assertEquals($uri, $http->__toString());
24
        $this->assertEquals('https', $http->getScheme());
25
        $this->assertEquals('user:password', $http->getUserInfo());
26
        $this->assertEquals('example.com', $http->getHost());
27
        $this->assertEquals(8042, $http->getPort());
28
        $this->assertEquals('user:[email protected]:8042', $http->getAuthority());
29
        $this->assertEquals('/over/there', $http->getPath());
30
        $this->assertEquals('name=ferret', $http->getQuery());
31
        $this->assertEquals('nose', $http->getFragment());
32
    }
33
34
    public function testValidSimpleUri()
35
    {
36
        $uri = 'http://example.com';
37
        $http = HttpUri::createFromString($uri);
38
39
        $this->assertInstanceOf('LoginCidadao\RemoteClaimsBundle\Model\HttpUri', $http);
40
        $this->assertEquals($uri, $http->__toString());
41
        $this->assertEquals('http', $http->getScheme());
42
        $this->assertEquals('', $http->getUserInfo());
43
        $this->assertEquals('example.com', $http->getHost());
44
        $this->assertNull($http->getPort());
45
        $this->assertEquals('example.com', $http->getAuthority());
46
        $this->assertEquals('', $http->getPath());
47
        $this->assertEquals('', $http->getQuery());
48
        $this->assertEquals('', $http->getFragment());
49
    }
50
}
51