packages/sql-semantics-mysql/tests/Unit/Rules/Noise/ExpressionNoiseTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Rules\Noise;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Rules\Noise\ExpressionNoise;
11
12#[CoversClass(ExpressionNoise::class)]
13#[Small]
14final class ExpressionNoiseTest extends TestCase
15{
16    public function testPositionsListsNoOptionalWordSinceTheModelKeepsThem(): void
17    {
18        self::assertSame([], ExpressionNoise::positions());
19    }
20
21    public function testSynonymsKeyTheSynonymTerminalsAsTheWrittenOnes(): void
22    {
23        self::assertSame([
24            'and: AND_AND_SYM' => [0 => 'AND_SYM'],
25            'or: OR2_SYM' => [0 => 'OR_SYM'],
26            'not2: NOT2_SYM' => [0 => '!'],
27            'bit_expr: bit_expr MOD_SYM bit_expr' => [1 => '%'],
28            'simple_expr: CONVERT_SYM ( expr , cast_type )' => [0 => 'CAST_SYM', 3 => 'AS'],
29        ], ExpressionNoise::synonyms());
30    }
31}
32