packages/bison-parser/tests/Unit/Ast/Declaration/OptionTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Ast\Declaration;
6
7use BisonParser\Ast\Declaration\Option;
8use BisonParser\Ast\Location;
9use PHPUnit\Framework\Attributes\CoversClass;
10use PHPUnit\Framework\Attributes\Small;
11use PHPUnit\Framework\Attributes\UsesClass;
12use PHPUnit\Framework\TestCase;
13
14#[CoversClass(Option::class)]
15#[UsesClass(Location::class)]
16#[Small]
17final class OptionTest extends TestCase
18{
19    public function testLocation(): void
20    {
21        $declaration = new Option('header', '%defines', null, new Location(3, 1));
22
23        self::assertSame('3:1', (string) $declaration->location());
24        self::assertSame('header', $declaration->name);
25        self::assertSame('%defines', $declaration->raw);
26        self::assertNull($declaration->value);
27    }
28}
29