File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 77
88class SettingsParseArgumentsTest extends UnitTestCase
99{
10+ /**
11+ * Test that an exception is thrown when an unsupported argument is passed.
12+ *
13+ * @dataProvider dataParseArgumentsInvalidArgument
14+ *
15+ * @param string $command The command as received from the command line.
16+ * @param string $unsupported The unsupported argument which should trigger the exception.
17+ *
18+ * @return void
19+ */
20+ public function testParseArgumentsInvalidArgument ($ command , $ unsupported )
21+ {
22+ $ this ->expectExceptionPolyfill ('PHP_Parallel_Lint\PhpParallelLint\Exceptions\InvalidArgumentException ' );
23+ $ this ->expectExceptionMessagePolyfill ('Invalid argument ' . $ unsupported );
24+
25+ $ argv = explode (' ' , $ command );
26+ Settings::parseArguments ($ argv );
27+ }
28+
29+ /**
30+ * Data provider.
31+ *
32+ * @return array
33+ */
34+ public function dataParseArgumentsInvalidArgument ()
35+ {
36+ return array (
37+ 'Unsupported short argument ' => array (
38+ 'command ' => './parallel-lint --colors -u . --exclude vendor ' ,
39+ 'unsupported ' => '-u ' ,
40+ ),
41+ 'Unsupported long argument ' => array (
42+ 'command ' => './parallel-lint . --no-progress --unsupported-arg ' ,
43+ 'unsupported ' => '--unsupported-arg ' ,
44+ ),
45+ 'Unsupported argument split by = sign ' => array (
46+ 'command ' => './parallel-lint --exclude=vendor ' ,
47+ 'unsupported ' => '--exclude=vendor ' ,
48+ ),
49+ );
50+ }
51+
1052 /**
1153 * Test parsing the arguments received from the command line.
1254 *
You can’t perform that action at this time.
0 commit comments