packages/sql-semantics-postgres/tests/Unit/Statement/Object/Attribute/Known/OperatorAttributeTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Object\Attribute\Known;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Known\OperatorAttribute;
11use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Reading;
12
13#[CoversClass(OperatorAttribute::class)]
14#[Small]
15final class OperatorAttributeTest extends TestCase
16{
17    public function testReadingFollowsTheCommand(): void
18    {
19        self::assertSame([Reading::Type, Reading::Function, Reading::Operator, Reading::Boolean, Reading::Ignored], [OperatorAttribute::Leftarg->reading(), OperatorAttribute::Procedure->reading(), OperatorAttribute::Negator->reading(), OperatorAttribute::Hashes->reading(), OperatorAttribute::Sort1->reading()]);
20    }
21
22    public function testNamedComparesRespectingCase(): void
23    {
24        self::assertSame([OperatorAttribute::Leftarg, null], [OperatorAttribute::named('leftarg'), OperatorAttribute::named('LEFTARG')]);
25    }
26
27    public function testTextIsTheAttributeName(): void
28    {
29        self::assertSame('leftarg', OperatorAttribute::Leftarg->text());
30    }
31}
32