packages/sql-semantics-sqlite/tests/Unit/Model/Statement/Identifier/NameTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Model\Statement\Identifier;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name;
11use SqlSemantics\Platform\Sqlite\Semantics;
12
13#[CoversClass(Name::class)]
14#[Medium]
15final class NameTest extends TestCase
16{
17 public function testValueIsTheDecodedIdentifier(): void
18 {
19 self::assertSame('order items', (new Name('order items'))->value);
20 }
21
22 public function testValueIsDecodedFromEveryQuotingStyleOfTheProfile(): void
23 {
24 $operation = (new Semantics())->analyze('SELECT a FROM `a b`, [c d], "e f"');
25
26 self::assertSame('SELECT a FROM `a b`, `c d`, `e f`', $operation->toString());
27 }
28}
29