1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace VolumeTests; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use CommonTestClass; |
7
|
|
|
use kalanis\kw_files\FilesException; |
8
|
|
|
use kalanis\kw_files\Processing\Volume\ProcessNode; |
9
|
|
|
use kalanis\kw_paths\PathsException; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class NodeTest extends CommonTestClass |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @throws FilesException |
16
|
|
|
* @throws PathsException |
17
|
|
|
*/ |
18
|
|
|
public function testThrough(): void |
19
|
|
|
{ |
20
|
|
|
$lib = new ProcessNode(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'tree'); |
21
|
|
|
$this->assertFalse($lib->exists(['unknown'])); |
22
|
|
|
$this->assertTrue($lib->exists(['dummy2.txt'])); |
23
|
|
|
$this->assertTrue($lib->exists(['sub'])); |
24
|
|
|
$this->assertTrue($lib->exists(['sub', 'dummy3.txt'])); |
25
|
|
|
|
26
|
|
|
$this->assertFalse($lib->isDir(['unknown'])); |
27
|
|
|
$this->assertFalse($lib->isReadable(['unknown'])); |
28
|
|
|
$this->assertFalse($lib->isWritable(['unknown'])); |
29
|
|
|
$this->assertFalse($lib->isDir(['dummy2.txt'])); |
30
|
|
|
$this->assertTrue($lib->isDir(['sub'])); |
31
|
|
|
$this->assertTrue($lib->isReadable(['sub'])); |
32
|
|
|
$this->assertTrue($lib->isWritable(['sub'])); |
33
|
|
|
|
34
|
|
|
$this->assertFalse($lib->isFile(['unknown'])); |
35
|
|
|
$this->assertFalse($lib->isReadable(['unknown'])); |
36
|
|
|
$this->assertFalse($lib->isWritable(['unknown'])); |
37
|
|
|
$this->assertTrue($lib->isFile(['dummy2.txt'])); |
38
|
|
|
$this->assertTrue($lib->isReadable(['dummy2.txt'])); |
39
|
|
|
$this->assertTrue($lib->isWritable(['dummy2.txt'])); |
40
|
|
|
$this->assertFalse($lib->isFile(['sub'])); |
41
|
|
|
|
42
|
|
|
$this->assertNull($lib->size(['unknown'])); |
43
|
|
|
$this->assertEquals(36, $lib->size(['dummy2.txt'])); |
44
|
|
|
$this->assertEquals(4096, $lib->size(['sub'])); |
45
|
|
|
|
46
|
|
|
$this->assertNull($lib->created(['unknown'])); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|