packages/sql-fixture/tests/Unit/Plan/Exception/InvalidTableNameExceptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Plan\Exception;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\UsesClass;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlFixture\Plan\Exception\InvalidTableNameException::class)]
12#[UsesClass(\SqlFixture\Plan\PlanSyntaxException::class)]
13#[UsesClass(\SqlFixture\Plan\Exception\EmptyPlanException::class)]
14#[UsesClass(\SqlFixture\Plan\Exception\EmptyTableNameException::class)]
15#[UsesClass(\SqlFixture\Plan\Exception\MissingEndpointColumnsException::class)]
16#[UsesClass(\SqlFixture\Plan\Exception\UnbalancedBracketsException::class)]
17#[UsesClass(\SqlFixture\Plan\Exception\UnexpectedPlanTokenException::class)]
18#[UsesClass(\SqlFixture\Plan\Exception\UnsupportedManyToManyException::class)]
19#[UsesClass(\SqlFixture\Plan\Exception\CompositeArityMismatchException::class)]
20#[UsesClass(\SqlFixture\Plan\Choice\ChoiceValidation::class)]
21#[UsesClass(\SqlFixture\Plan\Choice\PlanContents::class)]
22final class InvalidTableNameExceptionTest extends TestCase
23{
24 public function testDescribesInvalidTableName(): void
25 {
26 $exception = new \SqlFixture\Plan\Exception\InvalidTableNameException('order.id < order_detail.order_id');
27 $message = $exception->getMessage();
28
29 self::assertSame(
30 'A FixturePlan part must be a Relation or a plain table name, but '
31 . '"order.id < order_detail.order_id" is neither. To build a plan from relation '
32 . 'syntax, use FixturePlan::from().',
33 $message
34 );
35 self::assertSame('order.id < order_detail.order_id', $exception->part);
36 }
37}
38