packages/sql-semantics-mysql/tests/Unit/Statement/Table/Column/ColumnAttributeTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Table\Column;
6
7use PHPUnit\Framework\Attributes\CoversNothing;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Model\Construction\Derivation;
11use SqlSemantics\Platform\MySql\Model\Contract\ParameterStyle;
12use SqlSemantics\Platform\MySql\Platform;
13use SqlSemantics\Platform\MySql\Statement\Literal\BooleanLiteral;
14use SqlSemantics\Platform\MySql\Statement\Table\Column\ColumnAttribute;
15use SqlSemantics\Platform\MySql\Statement\Table\Column\DefaultLiteral;
16use SqlSemantics\Platform\MySql\Statement\Table\Column\KeywordAttribute;
17
18#[CoversNothing]
19#[Small]
20final class ColumnAttributeTest extends TestCase
21{
22 public function testImplementationsDeclareTheInterface(): void
23 {
24 self::assertContains(ColumnAttribute::class, class_implements(KeywordAttribute::class));
25 }
26
27 public function testDeriveAttributeIsDeclaredByTheInterface(): void
28 {
29 $platform = new Platform();
30 $derivation = new Derivation($platform->context($platform->profile('mysql-8.4.7', null, ParameterStyle::Native), null, [], true));
31 $literal = new BooleanLiteral(true);
32 $attribute = new DefaultLiteral($literal);
33 $attribute->deriveAttribute($derivation, $derivation->environment());
34
35 self::assertTrue($derivation->facts()->covers($literal));
36 }
37}
38