|
| 1 | +<?php |
| 2 | +namespace Aboks\PhpSrcDevtools\Command; |
| 3 | + |
| 4 | +use Aboks\PhpSrcDevtools\ConsoleProcessBridge; |
| 5 | +use Aboks\PhpSrcDevtools\DockerImage; |
| 6 | +use Symfony\Component\Console\Command\Command; |
| 7 | +use Symfony\Component\Console\Input\InputArgument; |
| 8 | +use Symfony\Component\Console\Input\InputInterface; |
| 9 | +use Symfony\Component\Console\Output\OutputInterface; |
| 10 | + |
| 11 | +class TestCommand extends Command |
| 12 | +{ |
| 13 | + |
| 14 | + protected function configure() |
| 15 | + { |
| 16 | + $this->setName("test"); |
| 17 | + $this->setDescription("Runs PHP's test suite"); |
| 18 | + |
| 19 | + $this->addArgument("tests", InputArgument::OPTIONAL, "subset of tests to run"); |
| 20 | + } |
| 21 | + |
| 22 | + protected function execute(InputInterface $input, OutputInterface $output) |
| 23 | + { |
| 24 | + $dockerArguments = []; |
| 25 | + if ($input->hasArgument('tests')) { |
| 26 | + $dockerArguments[] = $input->getArgument('tests'); |
| 27 | + } |
| 28 | + |
| 29 | + $dockerImage = new DockerImage(); |
| 30 | + $process = $dockerImage->createProcess('test', $dockerArguments); |
| 31 | + $process->setTimeout(null); |
| 32 | + |
| 33 | + return ConsoleProcessBridge::runProcessFromConsole($process, $input, $output); |
| 34 | + } |
| 35 | +} |
0 commit comments