Passed
Push — master ( cb2d88...e8a992 )
by Petr
08:25
created

FileTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testPass() 0 5 1
A testFail() 0 5 1
1
<?php
2
3
namespace TraitsTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_files\FilesException;
8
use kalanis\kw_files\Interfaces\IProcessFiles;
9
use kalanis\kw_files\Traits\TFile;
10
11
12
class FileTest extends CommonTestClass
13
{
14
    /**
15
     * @throws FilesException
16
     */
17
    public function testPass(): void
18
    {
19
        $lib = new XFile();
20
        $lib->setProcessFile(new XProcessFile());
21
        $this->assertNotEmpty($lib->getProcessFile());
22
    }
23
24
    /**
25
     * @throws FilesException
26
     */
27
    public function testFail(): void
28
    {
29
        $lib = new XFile();
30
        $this->expectException(FilesException::class);
31
        $lib->getProcessFile();
32
    }
33
}
34
35
36
class XFile
37
{
38
    use TFile;
39
}
40
41
42
class XProcessFile implements IProcessFiles
43
{
44
    public function saveFile(array $entry, $content): bool
45
    {
46
        return true;
47
    }
48
49
    public function readFile(array $entry, ?int $offset = null, ?int $length = null)
50
    {
51
        return '';
52
    }
53
54
    public function copyFile(array $source, array $dest): bool
55
    {
56
        return true;
57
    }
58
59
    public function moveFile(array $source, array $dest): bool
60
    {
61
        return true;
62
    }
63
64
    public function deleteFile(array $entry): bool
65
    {
66
        return true;
67
    }
68
}
69