|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace MapperTests; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use kalanis\kw_files\FilesException; |
|
7
|
|
|
use kalanis\kw_mapper\MapperException; |
|
8
|
|
|
use kalanis\kw_paths\PathsException; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class NodeTest extends AStorageTest |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @throws FilesException |
|
15
|
|
|
* @throws MapperException |
|
16
|
|
|
* @throws PathsException |
|
17
|
|
|
*/ |
|
18
|
|
|
public function testThrough(): void |
|
19
|
|
|
{ |
|
20
|
|
|
if ($this->skipIt) { |
|
21
|
|
|
$this->markTestSkipped('Skipped by config'); |
|
22
|
|
|
return; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
$this->dataRefill(); |
|
26
|
|
|
|
|
27
|
|
|
$lib = $this->getNodeLib(); |
|
28
|
|
|
$this->assertFalse($lib->exists(['unknown'])); |
|
29
|
|
|
$this->assertTrue($lib->exists(['dummy2.txt'])); |
|
30
|
|
|
$this->assertTrue($lib->exists(['sub'])); |
|
31
|
|
|
$this->assertTrue($lib->exists(['sub', 'dummy3.txt'])); |
|
32
|
|
|
|
|
33
|
|
|
$this->assertFalse($lib->isDir(['unknown'])); |
|
34
|
|
|
$this->assertTrue($lib->isReadable(['unknown'])); // because cannot check real status on flat k-v storage |
|
35
|
|
|
$this->assertTrue($lib->isWritable(['unknown'])); |
|
36
|
|
|
$this->assertFalse($lib->isDir(['dummy2.txt'])); |
|
37
|
|
|
$this->assertTrue($lib->isDir(['sub'])); |
|
38
|
|
|
$this->assertTrue($lib->isReadable(['sub'])); |
|
39
|
|
|
$this->assertTrue($lib->isWritable(['sub'])); |
|
40
|
|
|
|
|
41
|
|
|
$this->assertFalse($lib->isFile(['unknown'])); |
|
42
|
|
|
$this->assertTrue($lib->isFile(['dummy2.txt'])); |
|
43
|
|
|
$this->assertFalse($lib->isFile(['sub'])); |
|
44
|
|
|
|
|
45
|
|
|
$this->assertNull($lib->size(['unknown'])); |
|
46
|
|
|
$this->assertEquals(36, $lib->size(['dummy2.txt'])); |
|
47
|
|
|
$this->assertEquals(36, $lib->size(['other1.txt'])); |
|
48
|
|
|
$this->assertEquals(6, $lib->size(['sub'])); |
|
49
|
|
|
|
|
50
|
|
|
$this->assertNull($lib->created(['unknown'])); |
|
51
|
|
|
$this->assertEquals(123456789, $lib->created(['sub'])); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @throws FilesException |
|
56
|
|
|
* @throws MapperException |
|
57
|
|
|
* @throws PathsException |
|
58
|
|
|
*/ |
|
59
|
|
|
public function testRoot(): void |
|
60
|
|
|
{ |
|
61
|
|
|
if ($this->skipIt) { |
|
62
|
|
|
$this->markTestSkipped('Skipped by config'); |
|
63
|
|
|
return; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
$this->dataRefill(); |
|
67
|
|
|
|
|
68
|
|
|
$lib = $this->getNodeLib(); |
|
69
|
|
|
$this->assertTrue($lib->exists([])); |
|
70
|
|
|
$this->assertTrue($lib->isDir([])); |
|
71
|
|
|
$this->assertFalse($lib->isFile([])); |
|
72
|
|
|
$this->assertNull($lib->size([])); |
|
|
|
|
|
|
73
|
|
|
$this->assertNull($lib->created([])); |
|
|
|
|
|
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.