packages/bison-parser/tests/Unit/Ast/Declaration/Symbols/SymbolEntryTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Ast\Declaration\Symbols;
6
7use BisonParser\Ast\Declaration\Symbols\Alias;
8use BisonParser\Ast\Declaration\Symbols\SymbolEntry;
9use BisonParser\Ast\Location;
10use BisonParser\Ast\Symbol;
11use BisonParser\Ast\SymbolKind;
12use PHPUnit\Framework\Attributes\CoversClass;
13use PHPUnit\Framework\Attributes\Small;
14use PHPUnit\Framework\Attributes\UsesClass;
15use PHPUnit\Framework\TestCase;
16
17#[CoversClass(SymbolEntry::class)]
18#[UsesClass(Alias::class)]
19#[UsesClass(Location::class)]
20#[UsesClass(Symbol::class)]
21#[UsesClass(SymbolKind::class)]
22#[Small]
23final class SymbolEntryTest extends TestCase
24{
25 public function testAlias(): void
26 {
27 $entry = new SymbolEntry(new Symbol(SymbolKind::Identifier, 'NUM', new Location(1, 13)), 'int', 258, new Alias('number', false, new Location(1, 21)));
28
29 self::assertSame('NUM', $entry->symbol->value);
30 self::assertSame('int', $entry->tag);
31 self::assertSame(258, $entry->number);
32 self::assertSame('number', $entry->alias?->text);
33 }
34}
35