ServerDumpCommandTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\VarDumper\Tests\Command;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Console\Tester\CommandCompletionTester;
  13. use Symfony\Component\VarDumper\Command\ServerDumpCommand;
  14. use Symfony\Component\VarDumper\Server\DumpServer;
  15. class ServerDumpCommandTest extends TestCase
  16. {
  17. /**
  18. * @dataProvider provideCompletionSuggestions
  19. */
  20. public function testComplete(array $input, array $expectedSuggestions)
  21. {
  22. if (!class_exists(CommandCompletionTester::class)) {
  23. $this->markTestSkipped('Test command completion requires symfony/console 5.4+.');
  24. }
  25. $tester = new CommandCompletionTester($this->createCommand());
  26. $this->assertSame($expectedSuggestions, $tester->complete($input));
  27. }
  28. public static function provideCompletionSuggestions()
  29. {
  30. yield 'option --format' => [
  31. ['--format', ''],
  32. ['cli', 'html'],
  33. ];
  34. }
  35. private function createCommand(): ServerDumpCommand
  36. {
  37. return new ServerDumpCommand($this->createMock(DumpServer::class));
  38. }
  39. }