-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevkitExceptionTest.php
More file actions
43 lines (34 loc) · 1.23 KB
/
DevkitExceptionTest.php
File metadata and controls
43 lines (34 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
namespace KaririCode\Devkit\Tests\Unit\Exception;
use KaririCode\Devkit\Exception\DevkitException;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
#[CoversNothing]
final class DevkitExceptionTest extends TestCase
{
#[Test]
public function projectNotDetectedContainsPathInMessage(): void
{
$path = '/some/project/path';
$ex = DevkitException::projectNotDetected($path);
$this->assertInstanceOf(DevkitException::class, $ex);
$this->assertStringContainsString($path, $ex->getMessage());
$this->assertStringContainsString('composer.json', $ex->getMessage());
}
#[Test]
public function directoryNotWritableContainsPathInMessage(): void
{
$path = '/some/readonly/dir';
$ex = DevkitException::directoryNotWritable($path);
$this->assertInstanceOf(DevkitException::class, $ex);
$this->assertStringContainsString($path, $ex->getMessage());
}
#[Test]
public function exceptionExtendsRuntimeException(): void
{
$ex = DevkitException::projectNotDetected('/foo');
$this->assertInstanceOf(\RuntimeException::class, $ex);
}
}