File tree Expand file tree Collapse file tree 8 files changed +109
-2
lines changed
Expand file tree Collapse file tree 8 files changed +109
-2
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ protected function prepareCommand(): string
4646 $ command .= $ this ->args [self ::EXECUTABLE_PATH_OPTION ];
4747 break ;
4848 case self ::PATHS :
49- $ command .= ' ' . implode (', ' , $ this ->args [$ option ]);
49+ $ command .= ' ' . implode (' ' , $ this ->args [$ option ]);
5050 break ;
5151 case self ::EXCLUDE :
5252 $ prefix = $ this ->addPrefixToArray ($ this ->args [self ::EXCLUDE ], '--exclude ' );
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ protected function prepareCommand(): string
6060 $ command .= $ this ->args [self ::EXECUTABLE_PATH_OPTION ] . ' analyse ' ;
6161 break ;
6262 case self ::PATHS :
63- $ command .= ' ' . implode (', ' , $ this ->args [$ option ]);
63+ $ command .= ' ' . implode (' ' , $ this ->args [$ option ]);
6464 break ;
6565 case self ::PHPSTAN_CONFIGURATION_FILE :
6666 $ command .= ' -c ' . $ this ->args [self ::PHPSTAN_CONFIGURATION_FILE ];
Original file line number Diff line number Diff line change @@ -99,4 +99,22 @@ function it_replaces_phpcs_for_phpcbf_in_executablePath()
9999 $ configuration ['executablePath ' ] = 'path/tools/phpcbf ' ;
100100 $ this ->assertEquals ($ configuration , $ phpcbf ->getArguments ());
101101 }
102+
103+ /** @test */
104+ function it_sets_phpcbf_to_run_against_and_ignore_several_paths ()
105+ {
106+ $ configuration = [
107+ 'executablePath ' => 'path/tools/phpcs ' ,
108+ 'paths ' => ['src ' , 'tests ' ],
109+ 'standard ' => 'PSR12 ' ,
110+ 'ignore ' => ['vendor ' , 'app ' ],
111+ ];
112+
113+ $ toolConfiguration = new ToolConfiguration ('phpcbf ' , $ configuration );
114+
115+ $ phpcbf = new PhpcbfFake ($ toolConfiguration );
116+
117+ $ this ->assertStringContainsString ('src tests ' , $ phpcbf ->prepareCommand ());
118+ $ this ->assertStringContainsString ('--ignore=vendor,app ' , $ phpcbf ->prepareCommand ());
119+ }
102120}
Original file line number Diff line number Diff line change @@ -125,4 +125,22 @@ function it_checks_type_and_posible_values_for_every_argument()
125125 unset($ configuration ['executablePath ' ]);
126126 $ this ->assertEquals ($ configuration , $ phpcs ->getArguments ());
127127 }
128+
129+ /** @test */
130+ function it_sets_phpcs_to_run_against_and_ignore_several_paths ()
131+ {
132+ $ configuration = [
133+ 'executablePath ' => 'path/tools/phpcs ' ,
134+ 'paths ' => ['src ' , 'tests ' ],
135+ 'standard ' => 'PSR12 ' ,
136+ 'ignore ' => ['vendor ' , 'app ' ],
137+ ];
138+
139+ $ toolConfiguration = new ToolConfiguration ('phpcs ' , $ configuration );
140+
141+ $ phpcs = new PhpcsFake ($ toolConfiguration );
142+
143+ $ this ->assertStringContainsString ('src tests ' , $ phpcs ->prepareCommand ());
144+ $ this ->assertStringContainsString ('--ignore=vendor,app ' , $ phpcs ->prepareCommand ());
145+ }
128146}
Original file line number Diff line number Diff line change @@ -72,4 +72,22 @@ function it_ignores_unexpected_arguments_from_parallelLint_configuration()
7272 unset($ configuration ['unexpected or supported argument ' ]);
7373 $ this ->assertEquals ($ configuration , $ parallelLint ->getArguments ());
7474 }
75+
76+ /** @test */
77+ function it_sets_parallelLint_to_run_against_and_ignore_several_paths ()
78+ {
79+ $ configuration = [
80+ 'executablePath ' => 'path/tools/parallel-lint ' ,
81+ 'paths ' => ['src ' , 'tests ' ],
82+ 'exclude ' => ['vendor ' , 'app ' ],
83+ 'otherArguments ' => '--colors ' ,
84+ ];
85+
86+ $ toolConfiguration = new ToolConfiguration ('parallel-lint ' , $ configuration );
87+
88+ $ parallelLint = new ParallelLintFake ($ toolConfiguration );
89+
90+ $ this ->assertStringEndsWith ('src tests ' , $ parallelLint ->prepareCommand ());
91+ $ this ->assertStringContainsString ('--exclude vendor --exclude app ' , $ parallelLint ->prepareCommand ());
92+ }
7593}
Original file line number Diff line number Diff line change @@ -78,4 +78,22 @@ function it_ignores_unexpected_arguments_from_phpstan_configuration()
7878 unset($ configuration ['unexpected or supported argument ' ]);
7979 $ this ->assertEquals ($ configuration , $ phpstan ->getArguments ());
8080 }
81+
82+ /**
83+ * @test
84+ * Phpstan doesn't have exclude argument. The excludes must be setted in phpstan config file
85+ */
86+ function it_sets_phpstan_to_run_against_several_paths ()
87+ {
88+ $ configuration = [
89+ 'executablePath ' => 'path/tools/phpstan ' ,
90+ 'paths ' => ['src ' , 'tests ' ],
91+ ];
92+
93+ $ toolConfiguration = new ToolConfiguration ('phpstan ' , $ configuration );
94+
95+ $ phpstan = new PhpstanFake ($ toolConfiguration );
96+
97+ $ this ->assertStringEndsWith ('src tests ' , $ phpstan ->prepareCommand ());
98+ }
8199}
Original file line number Diff line number Diff line change @@ -72,4 +72,21 @@ function it_ignores_unexpected_arguments_from_phpcpd_configuration()
7272 unset($ configuration ['unexpected or supported argument ' ]);
7373 $ this ->assertEquals ($ configuration , $ phpcpd ->getArguments ());
7474 }
75+
76+ /** @test */
77+ function it_sets_phpcpd_to_run_against_and_ignore_several_paths ()
78+ {
79+ $ configuration = [
80+ 'executablePath ' => 'path/tools/phpcpd ' ,
81+ 'paths ' => ['src ' , 'tests ' ],
82+ 'exclude ' => ['vendor ' , 'app ' ],
83+ ];
84+
85+ $ toolConfiguration = new ToolConfiguration ('phpcpd ' , $ configuration );
86+
87+ $ phpcpd = new PhpcpdFake ($ toolConfiguration );
88+
89+ $ this ->assertStringEndsWith ('src tests ' , $ phpcpd ->prepareCommand ());
90+ $ this ->assertStringContainsString ('--exclude vendor --exclude app ' , $ phpcpd ->prepareCommand ());
91+ }
7592}
Original file line number Diff line number Diff line change @@ -75,4 +75,22 @@ function it_ignores_unexpected_arguments()
7575 unset($ configuration ['unexpected or supported argument ' ]);
7676 $ this ->assertEquals ($ configuration , $ phpmd ->getArguments ());
7777 }
78+
79+ /** @test */
80+ function it_sets_phpmd_to_run_against_and_ignore_several_paths ()
81+ {
82+ $ configuration = [
83+ 'executablePath ' => 'path/tools/phpmd ' ,
84+ 'paths ' => ['src ' , 'tests ' ],
85+ 'rules ' => 'unusedcode ' ,
86+ 'exclude ' => ['vendor ' , 'app ' ],
87+ ];
88+
89+ $ toolConfiguration = new ToolConfiguration ('phpmd ' , $ configuration );
90+
91+ $ phpmd = new PhpmdFake ($ toolConfiguration );
92+
93+ $ this ->assertStringContainsString ('src,tests ' , $ phpmd ->prepareCommand ());
94+ $ this ->assertStringContainsString ('--exclude "vendor,app" ' , $ phpmd ->prepareCommand ());
95+ }
7896}
You can’t perform that action at this time.
0 commit comments