Passed
Push — master ( 2b14a7...fa4f50 )
by Petr
02:38
created

NodeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 42
rs 10
wmc 2
1
<?php
2
3
namespace StorageDirsTests;
4
5
6
use kalanis\kw_files\FilesException;
7
use kalanis\kw_paths\PathsException;
8
9
10
class NodeTest extends AStorageTest
11
{
12
    /**
13
     * @throws FilesException
14
     * @throws PathsException
15
     */
16
    public function testThrough(): void
17
    {
18
        $lib = $this->getNodeLib();
19
        $this->assertFalse($lib->exists(['unknown']));
20
        $this->assertTrue($lib->exists(['dummy2.txt']));
21
        $this->assertTrue($lib->exists(['sub']));
22
        $this->assertTrue($lib->exists(['sub', 'dummy3.txt']));
23
24
        $this->assertFalse($lib->isDir(['unknown']));
25
        $this->assertFalse($lib->isDir(['dummy2.txt']));
26
        $this->assertTrue($lib->isDir(['sub']));
27
28
        $this->assertFalse($lib->isFile(['unknown']));
29
        $this->assertTrue($lib->isFile(['dummy2.txt']));
30
        $this->assertFalse($lib->isFile(['sub']));
31
32
        $this->assertNull($lib->size(['unknown']));
33
        $this->assertEquals(36, $lib->size(['dummy2.txt']));
34
        $this->assertEquals(4096, $lib->size(['sub']));
35
36
        $this->assertNull($lib->created(['unknown']));
37
        $this->assertNotNull($lib->created(['sub'])); // data here
38
    }
39
40
    /**
41
     * @throws FilesException
42
     * @throws PathsException
43
     */
44
    public function testRoot(): void
45
    {
46
        $lib = $this->getNodeLib();
47
        $this->assertTrue($lib->exists([]));
48
        $this->assertTrue($lib->isDir([]));
49
        $this->assertFalse($lib->isFile([]));
50
        $this->assertNotNull($lib->size([]));
51
        $this->assertNotNull($lib->created([]));
52
    }
53
}
54