packages/sql-semantics-sqlite/tests/Unit/Model/Statement/Spelling/SpelledTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Model\Statement\Spelling;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\Sqlite\Model\Statement\Spelling\Spelled;
11
12#[CoversClass(Spelled::class)]
13#[Small]
14final class SpelledTest extends TestCase
15{
16    public function testSpellingKeepsTheGapAndTheText(): void
17    {
18        $token = new Spelled(" /* c */\n", 'and');
19
20        self::assertSame(" /* c */\n", $token->gap);
21        self::assertSame('and', $token->text);
22    }
23
24    public function testSpellingRefusesAnEmptyToken(): void
25    {
26        $this->expectExceptionMessage('A spelled token is not empty.');
27
28        new Spelled(' ', '');
29    }
30}
31