|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace ParaTest\Console; |
|
6
|
|
|
|
|
7
|
|
|
use ParaTest\Console\Commands\ParaTestCommand; |
|
8
|
|
|
use ParaTest\Console\Testers\PHPUnit; |
|
9
|
|
|
use Symfony\Component\Console\Application; |
|
10
|
|
|
use Symfony\Component\Console\Input\InputDefinition; |
|
11
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
12
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
13
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
14
|
|
|
|
|
15
|
|
|
class ParaTestApplication extends Application |
|
16
|
|
|
{ |
|
17
|
|
|
const NAME = 'ParaTest'; |
|
18
|
|
|
const VERSION = '1.0.1'; |
|
19
|
|
|
|
|
20
|
|
|
public function __construct() |
|
21
|
|
|
{ |
|
22
|
|
|
parent::__construct(static::NAME, VersionProvider::getVersion(static::VERSION)); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Instantiates the specific Tester and runs it via the ParaTestCommand. |
|
27
|
|
|
* |
|
28
|
|
|
* @todo for now paratest will only run the phpunit command |
|
29
|
|
|
*/ |
|
30
|
|
|
public function doRun(InputInterface $input, OutputInterface $output) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->add(new ParaTestCommand(new PHPUnit())); |
|
33
|
|
|
|
|
34
|
|
|
return parent::doRun($input, $output); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The default InputDefinition for the application. Leave it to specific |
|
39
|
|
|
* Tester objects for specifying further definitions. |
|
40
|
|
|
* |
|
41
|
|
|
* @return InputDefinition |
|
42
|
|
|
*/ |
|
43
|
|
|
public function getDefinition(): InputDefinition |
|
44
|
|
|
{ |
|
45
|
|
|
return new InputDefinition([ |
|
46
|
|
|
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
47
|
|
|
]); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param InputInterface $input |
|
52
|
|
|
* |
|
53
|
|
|
* @return string |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getCommandName(InputInterface $input): string |
|
56
|
|
|
{ |
|
57
|
|
|
return 'paratest'; |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|