DirTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testFromFile() 0 4 1
A testBadPath() 0 4 1
A testPathGetter() 0 5 1
A testRealpath() 0 4 1
1
<?php
2
3
namespace CompoLab\Tests\Domain\ValueObject;
4
5
use CompoLab\Domain\ValueObject\Dir;
6
use PHPUnit\Framework\TestCase;
7
8
final class DirTest extends TestCase
9
{
10
    public function testFromFile()
11
    {
12
        $this->expectException(\InvalidArgumentException::class);
13
        new Dir(__DIR__ . '/../../../data/packages.json');
14
    }
15
16
    public function testBadPath()
17
    {
18
        $this->expectException(\InvalidArgumentException::class);
19
        new Dir(__DIR__ . '/../../../data/foobar');
20
    }
21
22
    public function testRealpath()
23
    {
24
        $dir = new Dir(__DIR__ . '/../../../data');
25
        self::assertRegExp('|^.+tests/data$|', (string) $dir);
26
    }
27
28
    public function testPathGetter()
29
    {
30
        $dir = new Dir(__DIR__ . '/../../../cache');
31
        $path = $dir->getPath('/archives');
32
        self::assertRegExp('|^.+tests/cache/archives$|', $path);
33
    }
34
}
35