Completed
Push — master ( 483be6...2f25cf )
by Marco
04:50
created

testFromNotWritableDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManagerTest\Exception;
6
7
use PHPUnit\Framework\TestCase;
8
use ProxyManager\Exception\FileNotWritableException;
9
10
/**
11
 * Tests for {@see \ProxyManager\Exception\FileNotWritableException}
12
 *
13
 * @covers \ProxyManager\Exception\FileNotWritableException
14
 * @group Coverage
15
 */
16
class FileNotWritableExceptionTest extends TestCase
17
{
18
    public function testFromInvalidMoveOperation() : void
19
    {
20
        $exception = FileNotWritableException::fromInvalidMoveOperation('/tmp/a', '/tmp/b');
21
22
        self::assertInstanceOf(FileNotWritableException::class, $exception);
23
        self::assertSame(
24
            'Could not move file "/tmp/a" to location "/tmp/b": either the source file is not readable,'
25
            . ' or the destination is not writable',
26
            $exception->getMessage()
27
        );
28
    }
29
30
    public function testFromNotWritableDirectory() : void
31
    {
32
        $exception = FileNotWritableException::fromNotWritableDirectory('/tmp/a');
33
34
        self::assertInstanceOf(FileNotWritableException::class, $exception);
35
        self::assertSame(
36
            'Could not create temp file in directory "/tmp/a" '
37
            . 'either the directory does not exist, or it is not writable',
38
            $exception->getMessage()
39
        );
40
    }
41
}
42