SingleCommandApplicationTest.php 971 B

12345678910111213141516171819202122232425262728293031323334
  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\Console\Tests\Command;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Console\Input\InputInterface;
  13. use Symfony\Component\Console\Output\OutputInterface;
  14. use Symfony\Component\Console\SingleCommandApplication;
  15. use Symfony\Component\Console\Tester\CommandTester;
  16. class SingleCommandApplicationTest extends TestCase
  17. {
  18. public function testRun()
  19. {
  20. $command = new class() extends SingleCommandApplication {
  21. protected function execute(InputInterface $input, OutputInterface $output): int
  22. {
  23. return 0;
  24. }
  25. };
  26. $command->setAutoExit(false);
  27. $this->assertSame(0, (new CommandTester($command))->execute([]));
  28. }
  29. }