1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration\Filesystem; |
4
|
|
|
|
5
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Directory; |
6
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException; |
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Directory |
11
|
|
|
* @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\AbstractFilesystemItem |
12
|
|
|
*/ |
13
|
|
|
class DirectoryPathNotExistsTest extends TestCase |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @test |
18
|
|
|
* @small |
19
|
|
|
*/ |
20
|
|
|
public function constructWithPathParamThatDoesNotExist(): Directory |
21
|
|
|
{ |
22
|
|
|
$pathNotExists = '/path/not/exists'; |
23
|
|
|
$object = new Directory($pathNotExists); |
24
|
|
|
self::assertSame($pathNotExists, $object->getPath()); |
25
|
|
|
self::assertFalse($object->exists()); |
26
|
|
|
|
27
|
|
|
return $object; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @test |
32
|
|
|
* @small |
33
|
|
|
* @depends constructWithPathParamThatDoesNotExist |
34
|
|
|
* |
35
|
|
|
* @param Directory $object |
36
|
|
|
* |
37
|
|
|
* @throws DoctrineStaticMetaException |
38
|
|
|
*/ |
39
|
|
|
public function assertExceptionOnGetObjectWhenPathDoesNotExist(Directory $object): void |
40
|
|
|
{ |
41
|
|
|
$this->expectException(DoctrineStaticMetaException::class); |
42
|
|
|
$this->expectExceptionMessage('directory does not exist at path'); |
43
|
|
|
$object->getSplFileInfo(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @test |
49
|
|
|
* @small |
50
|
|
|
* @depends constructWithPathParamThatDoesNotExist |
51
|
|
|
* |
52
|
|
|
* @param Directory $object |
53
|
|
|
* |
54
|
|
|
* @throws DoctrineStaticMetaException |
55
|
|
|
*/ |
56
|
|
|
public function assertExceptionOnGetFileInfoWhenPathDoesNotExist(Directory $object): void |
57
|
|
|
{ |
58
|
|
|
$this->expectException(DoctrineStaticMetaException::class); |
59
|
|
|
$this->expectExceptionMessage('directory does not exist at path'); |
60
|
|
|
$object->getSplFileInfo(); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|