Passed
Push — master ( b28c40...f61e74 )
by Petr
08:06
created

BasicTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 3
1
<?php
2
3
namespace SourcesTests\Files\Storage;
4
5
6
use kalanis\kw_auth\AuthException;
7
8
9
class BasicTest extends AStorageTests
10
{
11
    /**
12
     * @throws AuthException
13
     */
14
    public function testFiles(): void
15
    {
16
        $lib = new MockFiles();
17
        $content = $lib->open($this->sourcePath);
18
        $this->assertNotEmpty($content);
19
        $lib->save($this->testingPath, $content);
20
        chmod($this->testingPath, 0444);
21
        $this->expectException(AuthException::class);
22
        $lib->save($this->testingPath, $content);
23
    }
24
25
    /**
26
     * @throws AuthException
27
     */
28
    public function testFilesOpenCrash(): void
29
    {
30
        $lib = new MockFiles(new XCrashStorage());
31
        $this->expectException(AuthException::class);
32
        $lib->open($this->testingPath);
33
    }
34
35
    /**
36
     * @throws AuthException
37
     */
38
    public function testFilesCloseCrash(): void
39
    {
40
        $lib = new MockFiles(new XCrashStorage());
41
        $this->expectException(AuthException::class);
42
        $lib->save($this->testingPath, [['anything']]);
43
    }
44
}
45