FileAssertTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 40
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testThrowExceptionWhenFileIsNotFound() 0 5 1
A testThrowExceptionWhenFileHasWrongType() 0 5 1
A testSuccessfullyAssertFileType() 0 5 1
A testSuccessfullyAssertFile() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Dictionary\Features\PopulateStorage\Populate;
6
7
use App\Dictionary\Features\PopulateStorage\Populate\FileAssert;
8
use RuntimeException;
9
use App\Tests\Dictionary\DictionaryTestCase;
10
11
/**
12
 * @coversDefaultClass \App\Dictionary\Features\PopulateStorage\Populate\FileAssert
13
 */
14
final class FileAssertTest extends DictionaryTestCase
15
{
16
    /**
17
     * @covers ::assertFile
18
     */
19
    public function testSuccessfullyAssertFile(): void
20
    {
21
        FileAssert::assertFile(tempnam(sys_get_temp_dir(), 'test_'));
22
23
        self::assertTrue(true);
24
    }
25
26
    /**
27
     * @covers ::assertFile
28
     */
29
    public function testThrowExceptionWhenFileIsNotFound(): void
30
    {
31
        $this->expectException(RuntimeException::class);
32
33
        FileAssert::assertFile('/asf/test_file.txt');
34
    }
35
36
    /**
37
     * @covers ::assertTxtFile
38
     */
39
    public function testThrowExceptionWhenFileHasWrongType(): void
40
    {
41
        $this->expectException(RuntimeException::class);
42
43
        FileAssert::assertTxtFile($this->createTempFile('.pdf', ['test']));
44
    }
45
46
    /**
47
     * @covers ::assertTxtFile
48
     */
49
    public function testSuccessfullyAssertFileType(): void
50
    {
51
        FileAssert::assertTxtFile($this->createTempFile('.txt', ['test']));
52
53
        self::assertTrue(true);
54
    }
55
}
56