Passed
Push — master ( af3dcf...3709c1 )
by Petr
02:16
created

CommonTestClass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 3
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
5
6
/**
7
 * Class CommonTestClass
8
 * The structure for mocking and configuration seems so complicated, but it's necessary to let it be totally idiot-proof
9
 */
10
class CommonTestClass extends TestCase
11
{
12
    protected function tearDown(): void
13
    {
14
        $ptXM = $this->getTargetPath() . 'copy.meta';
15
        if (is_file($ptXM)) {
16
            @unlink($ptXM);
17
        }
18
    }
19
20
    protected function getTargetPath(): string
21
    {
22
        return __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'target' . DIRECTORY_SEPARATOR;
23
    }
24
25
    protected function getTargetPath2(): string
26
    {
27
        return __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'target';
28
    }
29
}
30
31
32
class XFailStorage extends \kalanis\kw_storage\Storage\Storage
33
{
34
    public function write(string $sharedKey, $data, ?int $timeout = null): bool
35
    {
36
        throw new \kalanis\kw_storage\StorageException('mock');
37
    }
38
39
    public function read(string $sharedKey)
40
    {
41
        throw new \kalanis\kw_storage\StorageException('mock');
42
    }
43
44
    public function exists(string $sharedKey): bool
45
    {
46
        throw new \kalanis\kw_storage\StorageException('mock');
47
    }
48
49
    public function lookup(string $mask): Traversable
50
    {
51
        throw new \kalanis\kw_storage\StorageException('mock');
52
    }
53
}
54