packages/ztd-query-core/tests/Unit/Exception/InvalidDefinitionExceptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Exception;
6
7use InvalidArgumentException;
8use PHPUnit\Framework\Attributes\CoversClass;
9use PHPUnit\Framework\TestCase;
10use ZtdQuery\Exception\InvalidDefinitionException;
11
12#[CoversClass(InvalidDefinitionException::class)]
13final class InvalidDefinitionExceptionTest extends TestCase
14{
15 public function testPreservesTheInvalidArgumentExceptionContract(): void
16 {
17 self::assertContains(
18 InvalidArgumentException::class,
19 class_parents(new InvalidDefinitionException('bad')),
20 );
21 }
22
23 public function testCarriesWhatWasWrongWithTheDefinition(): void
24 {
25 self::assertSame('A lexical delimiter must not be empty.', (new InvalidDefinitionException(
26 'A lexical delimiter must not be empty.',
27 ))->getMessage());
28 }
29}
30