-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorContextTest.php
More file actions
44 lines (37 loc) · 1.35 KB
/
ErrorContextTest.php
File metadata and controls
44 lines (37 loc) · 1.35 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
namespace Calvert\DndErrors\Tests;
use Calvert\DndErrors\ErrorContext;
use PHPUnit\Framework\TestCase;
final class ErrorContextTest extends TestCase
{
public function testCanCreateErrorContextWithAllProperties(): void
{
$context = new ErrorContext(
type: 'RuntimeException',
message: 'Test error message',
file: '/path/to/file.php',
line: 42,
trace: array('trace' => 'data'),
phpVersion: '8.1.0'
);
$this->assertSame('RuntimeException', $context->type);
$this->assertSame('Test error message', $context->message);
$this->assertSame('/path/to/file.php', $context->file);
$this->assertSame(42, $context->line);
$this->assertSame(array('trace' => 'data'), $context->trace);
$this->assertSame('8.1.0', $context->phpVersion);
}
public function testCanCreateErrorContextWithMinimalProperties(): void
{
$context = new ErrorContext(
type: 'Error',
message: 'Test message'
);
$this->assertSame('Error', $context->type);
$this->assertSame('Test message', $context->message);
$this->assertNull($context->file);
$this->assertNull($context->line);
$this->assertSame(array(), $context->trace);
$this->assertNull($context->phpVersion);
}
}