-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationExceptionTest.php
More file actions
46 lines (36 loc) · 1.36 KB
/
ConfigurationExceptionTest.php
File metadata and controls
46 lines (36 loc) · 1.36 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
44
45
46
<?php
declare(strict_types=1);
namespace KaririCode\Devkit\Tests\Unit\Exception;
use KaririCode\Devkit\Exception\ConfigurationException;
use KaririCode\Devkit\Exception\DevkitException;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
#[CoversNothing]
final class ConfigurationExceptionTest extends TestCase
{
#[Test]
public function invalidOverrideContainsKeyAndReasonInMessage(): void
{
$key = 'phpstan_level';
$reason = 'Expected integer, got string.';
$ex = ConfigurationException::invalidOverride($key, $reason);
$this->assertInstanceOf(ConfigurationException::class, $ex);
$this->assertStringContainsString($key, $ex->getMessage());
$this->assertStringContainsString($reason, $ex->getMessage());
}
#[Test]
public function fileNotReadableContainsPathInMessage(): void
{
$path = '/etc/shadow';
$ex = ConfigurationException::fileNotReadable($path);
$this->assertInstanceOf(ConfigurationException::class, $ex);
$this->assertStringContainsString($path, $ex->getMessage());
}
#[Test]
public function exceptionExtendsDevkitException(): void
{
$ex = ConfigurationException::invalidOverride('key', 'reason');
$this->assertInstanceOf(DevkitException::class, $ex);
}
}