packages/sql-semantics-postgres/tests/Unit/Statement/Object/Attribute/Known/AggregateAttributeTest.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\AggregateAttribute;
11use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Reading;
12
13#[CoversClass(AggregateAttribute::class)]
14#[Small]
15final class AggregateAttributeTest extends TestCase
16{
17 public function testReadingFollowsTheCommand(): void
18 {
19 self::assertSame([Reading::Function, Reading::Type, Reading::Integer, Reading::Text, Reading::Parallelism, Reading::FinalModification, Reading::Operator, Reading::Boolean], [AggregateAttribute::Sfunc1->reading(), AggregateAttribute::Stype->reading(), AggregateAttribute::Sspace->reading(), AggregateAttribute::Initcond->reading(), AggregateAttribute::Parallel->reading(), AggregateAttribute::FinalfuncModify->reading(), AggregateAttribute::Sortop->reading(), AggregateAttribute::Hypothetical->reading()]);
20 }
21
22 public function testNamedComparesRespectingCase(): void
23 {
24 self::assertSame([AggregateAttribute::Sfunc, null], [AggregateAttribute::named('sfunc'), AggregateAttribute::named('SFUNC')]);
25 }
26
27 public function testTextIsTheAttributeName(): void
28 {
29 self::assertSame('sfunc', AggregateAttribute::Sfunc->text());
30 }
31}
32