packages/sql-semantics/tests/Unit/AnalyzerTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\AnalysisException;
11use SqlSemantics\Analyzer;
12use SqlSemantics\Query;
13
14#[CoversClass(Analyzer::class)]
15#[Small]
16final class AnalyzerTest extends TestCase
17{
18 /**
19 * @throws AnalysisException
20 */
21 public function testAnalyzeAcceptsSqlWithoutAnExplicitContext(): void
22 {
23 $query = self::createStub(Query::class);
24 $analyzer = self::createStub(Analyzer::class);
25 $analyzer->method('analyze')->willReturn($query);
26
27 self::assertSame($query, $analyzer->analyze('SELECT 1'));
28 }
29}
30