8
8
use Symfony \Component \Console \Command \Command ;
9
9
use Symfony \Component \Console \Input \InputArgument ;
10
10
use Symfony \Component \Console \Input \InputInterface ;
11
+ use Symfony \Component \Console \Input \InputOption ;
11
12
use Symfony \Component \Console \Output \OutputInterface ;
12
13
13
14
/**
@@ -22,6 +23,12 @@ class DevTestsRunCommand extends Command
22
23
*/
23
24
const INPUT_ARG_TYPE = 'type ' ;
24
25
26
+ /**
27
+ * PHPUnit arguments parameter
28
+ */
29
+ const INPUT_OPT_COMMAND_ARGUMENTS = 'arguments ' ;
30
+ const INPUT_OPT_COMMAND_ARGUMENTS_SHORT = 'c ' ;
31
+
25
32
/**
26
33
* command name
27
34
*/
@@ -56,7 +63,13 @@ protected function configure()
56
63
'Type of test to run. Available types: ' . implode (', ' , array_keys ($ this ->types )),
57
64
'default '
58
65
);
59
-
66
+ $ this ->addOption (
67
+ self ::INPUT_OPT_COMMAND_ARGUMENTS ,
68
+ self ::INPUT_OPT_COMMAND_ARGUMENTS_SHORT ,
69
+ InputOption::VALUE_REQUIRED ,
70
+ 'Additional arguments for PHPUnit. Example: "-c \'--filter=MyTest \'" (no spaces) ' ,
71
+ ''
72
+ );
60
73
parent ::configure ();
61
74
}
62
75
@@ -87,6 +100,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
87
100
$ dirName = realpath (BP . '/dev/tests/ ' . $ dir );
88
101
chdir ($ dirName );
89
102
$ command = PHP_BINARY . ' ' . BP . '/ ' . $ vendorDir . '/phpunit/phpunit/phpunit ' . $ options ;
103
+ if ($ commandArguments = $ input ->getOption (self ::INPUT_OPT_COMMAND_ARGUMENTS )) {
104
+ $ command .= ' ' . $ commandArguments ;
105
+ }
90
106
$ message = $ dirName . '> ' . $ command ;
91
107
$ output ->writeln (['' , str_pad ("---- {$ message } " , 70 , '- ' ), '' ]);
92
108
passthru ($ command , $ returnVal );
0 commit comments