packages/ztd-query-core/tests/Unit/Exception/SimulationExceptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Exception;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\TestCase;
9use ZtdQuery\Exception\SimulationException;
10
11#[CoversClass(SimulationException::class)]
12final class SimulationExceptionTest extends TestCase
13{
14 public function testCarriesTheMessageItWasRefusedWith(): void
15 {
16 $exception = new class ('simulation failed') extends SimulationException {
17 };
18
19 self::assertSame('simulation failed', $exception->getMessage());
20 }
21
22 public function testCanBeCaughtAsTheOneKindOfFailureZtdProduces(): void
23 {
24 try {
25 throw new class ('simulation failed') extends SimulationException {
26 };
27 } catch (SimulationException $refusal) {
28 self::assertSame('simulation failed', $refusal->getMessage());
29
30 return;
31 }
32 }
33}
34