packages/sql-semantics-sqlite/tests/Unit/Model/Rendering/PieceTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Model\Rendering;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\Sqlite\Model\Rendering\Piece;
11use SqlSemantics\Platform\Sqlite\Model\Rendering\PieceKind;
12
13#[CoversClass(Piece::class)]
14#[Small]
15final class PieceTest extends TestCase
16{
17    public function testAPieceKeepsItsKindSpellingAndGlue(): void
18    {
19        $piece = new Piece(PieceKind::Symbol, ',', true);
20
21        self::assertSame(PieceKind::Symbol, $piece->kind);
22        self::assertSame(',', $piece->text);
23        self::assertTrue($piece->glued);
24    }
25
26    public function testAPieceIsNotGluedByDefault(): void
27    {
28        self::assertFalse((new Piece(PieceKind::Keyword, 'SELECT'))->glued);
29    }
30}
31