UrlTest::testBadUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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