UrlTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSshUrl() 0 4 1
A testHttpUrl() 0 4 1
A testBadUrl() 0 4 1
1
<?php
2
3
namespace CompoLab\Tests\Domain\ValueObject;
4
5
use CompoLab\Domain\ValueObject\Url;
6
use PHPUnit\Framework\TestCase;
7
8
final class UrlTest extends TestCase
9
{
10
    public function testBadUrl()
11
    {
12
        $this->expectException(\InvalidArgumentException::class);
13
        new Url('gitlab.my-website.com');
14
    }
15
16
    public function testHttpUrl()
17
    {
18
        $url = new Url('https://gitlab.my-website.com');
19
        self::assertRegExp('/^https:/', (string) $url);
20
    }
21
22
    public function testSshUrl()
23
    {
24
        $url = new Url('[email protected]:vendor/project.git');
25
        self::assertRegExp('/^git.*git$/', (string) $url);
26
    }
27
}
28