packages/sql-catalog/tests/Unit/Core/Php/MethodShapeTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Core\Php;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\UsesClass;
9use PHPUnit\Framework\TestCase;
10use SqlCatalog\Core\Php\MethodShape;
11use SqlCatalog\Core\Type\TypeShape;
12
13#[CoversClass(MethodShape::class)]
14#[UsesClass(TypeShape::class)]
15final class MethodShapeTest extends TestCase
16{
17 public function testQualifiedNameJoinsTheClassAndTheMethod(): void
18 {
19 $shape = new MethodShape('App\\Repository', 'find', [], TypeShape::of(['array']));
20 self::assertSame('App\\Repository::find', $shape->qualifiedName());
21 }
22
23 public function testKeepsWhatWasDeclared(): void
24 {
25 $shape = new MethodShape('App\\Repository', 'find', [], TypeShape::of(['array']), true, null, 'src/a.php');
26 self::assertTrue($shape->static);
27 self::assertSame('src/a.php', $shape->file);
28 self::assertNull($shape->node);
29 }
30}
31