packages/deriver/tests/Unit/Exception/ReportingExceptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Exception;
6
7use Deriver\Exception\ReportingException;
8use PHPUnit\Framework\Attributes\CoversClass;
9use PHPUnit\Framework\TestCase;
10use RuntimeException;
11
12#[CoversClass(ReportingException::class)]
13final class ReportingExceptionTest extends TestCase
14{
15 public function testGetMessageAndPreviousRetainTheDiagnosticAndCause(): void
16 {
17 $cause = new RuntimeException('cause');
18 $error = new ReportingException('diagnostic', previous: $cause);
19 self::assertSame('diagnostic', $error->getMessage());
20 self::assertSame($cause, $error->getPrevious());
21 }
22}
23