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

FileFailTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 55
rs 10
c 1
b 0
f 0
wmc 5
1
<?php
2
3
namespace StorageDirsTests;
4
5
6
use kalanis\kw_files\FilesException;
7
use kalanis\kw_paths\PathsException;
8
9
10
class FileFailTest extends AStorageTest
11
{
12
    /**
13
     * @throws FilesException
14
     * @throws PathsException
15
     */
16
    public function testRead(): void
17
    {
18
        $lib = $this->getFileFailLib();
19
        $this->expectException(FilesException::class);
20
        $lib->readFile(['dummy2.txt']);
21
    }
22
23
    /**
24
     * @throws FilesException
25
     * @throws PathsException
26
     */
27
    public function testSave(): void
28
    {
29
        $lib = $this->getFileFailLib();
30
        $this->expectException(FilesException::class);
31
        $lib->saveFile(['extra.txt'], 'qwertzuiopasdfghjklyxcvbnm0123456789');
32
    }
33
34
    /**
35
     * @throws FilesException
36
     * @throws PathsException
37
     */
38
    public function testCopy(): void
39
    {
40
        $lib = $this->getFileFailLib();
41
        $this->expectException(FilesException::class);
42
        $lib->copyFile(['dummy2.txt'], ['extra1.txt']);
43
    }
44
45
    /**
46
     * @throws FilesException
47
     * @throws PathsException
48
     */
49
    public function testMove(): void
50
    {
51
        $lib = $this->getFileFailLib();
52
        $this->expectException(FilesException::class);
53
        $lib->moveFile(['extra1.txt'], ['extra2.txt']);
54
    }
55
56
    /**
57
     * @throws FilesException
58
     * @throws PathsException
59
     */
60
    public function testDelete(): void
61
    {
62
        $lib = $this->getFileFailLib();
63
        $this->expectException(FilesException::class);
64
        $lib->deleteFile(['extra2.txt']);
65
    }
66
}
67