packages/deriver/tests/Unit/Command/InputTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Command;
6
7use Deriver\Command\DeriveCommand;
8use Deriver\Command\Input;
9use Deriver\Configuration\ReportFormat;
10use PHPUnit\Framework\Attributes\CoversNothing;
11use PHPUnit\Framework\TestCase;
12use Symfony\Component\Console\Input\ArrayInput;
13
14#[CoversNothing]
15final class InputTest extends TestCase
16{
17    public function testConfigurationReadsRepeatedPatternsAndLanguageOverrides(): void
18    {
19        $input = new ArrayInput(['query' => 'answer#return', '--path' => ['src', 'app'], '--include' => ['*.php', '*.inc'], '--exclude' => ['Generated'], '--php-version' => '8.4', '--format' => 'json'], (new DeriveCommand())->getDefinition());
20        $configuration = (new Input())->configuration($input);
21        self::assertSame(['src', 'app'], $configuration->paths);
22        self::assertSame(['*.php', '*.inc'], $configuration->include);
23        self::assertSame(['Generated'], $configuration->exclude);
24        self::assertSame('8.4', $configuration->phpVersion);
25        self::assertSame(ReportFormat::Json, $configuration->format);
26    }
27}
28