packages/sql-fixture/tests/Unit/Hydrator/HydrationExceptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Hydrator;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Test;
9use PHPUnit\Framework\TestCase;
10use SqlFixture\Hydrator\HydrationException;
11
12#[CoversClass(HydrationException::class)]
13#[\PHPUnit\Framework\Attributes\UsesClass(\SqlFixture\Hydrator\Exception\ClassNotFoundException::class)]
14#[\PHPUnit\Framework\Attributes\UsesClass(\SqlFixture\Hydrator\Exception\MissingConstructorArgumentException::class)]
15final class HydrationExceptionTest extends TestCase
16{
17 #[Test]
18 public function testClassNotFound(): void
19 {
20 $exception = new \SqlFixture\Hydrator\Exception\ClassNotFoundException('NonExistentClass');
21 self::assertSame('Class not found: NonExistentClass', $exception->getMessage());
22 }
23
24 #[Test]
25 public function testReportsMissingConstructorArgument(): void
26 {
27 $exception = new \SqlFixture\Hydrator\Exception\MissingConstructorArgumentException('User', 'name');
28 self::assertSame('Missing required constructor parameter "name" for class "User"', $exception->getMessage());
29 }
30
31}
32