@@ -48,6 +48,21 @@ public function testAnalyse(): void
4848 $ this ->assertEquals (Command::SUCCESS , $ tester ->getStatusCode (), 'Command should succeed ' );
4949 }
5050
51+ #[Test]
52+ #[DataProvider('multiplePathsDataProvider ' )]
53+ public function testAnalyseWithMultiplePaths (string $ path , string $ description ): void
54+ {
55+ $ application = new Application ();
56+ $ command = $ application ->getContainer ()->get (CognitiveMetricsCommand::class);
57+ $ tester = new CommandTester ($ command );
58+
59+ $ tester ->execute ([
60+ 'path ' => $ path ,
61+ ]);
62+
63+ $ this ->assertEquals (Command::SUCCESS , $ tester ->getStatusCode (), $ description );
64+ }
65+
5166 #[Test]
5267 #[DataProvider('reportDataProvider ' )]
5368 public function testAnalyseWithJsonReport (array $ input , int $ returnCode ): void
@@ -176,7 +191,7 @@ public function testOutputWithoutOptions(): void
176191 $ this ->assertStringEqualsFile (__DIR__ . '/OutputWithoutOptions.txt ' , $ tester ->getDisplay (true ));
177192 }
178193
179- #[\ PHPUnit \ Framework \ Attributes \ DataProvider('configurationOutputProvider ' )]
194+ #[DataProvider('configurationOutputProvider ' )]
180195 public function testConfigurationOutput (string $ configFile , string $ expectedOutputFile , string $ description ): void
181196 {
182197 $ application = new Application ();
@@ -238,4 +253,35 @@ public static function configurationOutputProvider(): array
238253 ],
239254 ];
240255 }
256+
257+ /**
258+ * Data provider for multiple paths tests
259+ *
260+ * @return array<int, array{string, string}>
261+ */
262+ public static function multiplePathsDataProvider (): array
263+ {
264+ return [
265+ 'multiple files ' => [
266+ __DIR__ . '/../../../src/Command/CognitiveMetricsCommand.php, ' . __DIR__ . '/../../../src/Business/MetricsFacade.php ' ,
267+ 'Command should succeed with multiple files '
268+ ],
269+ 'multiple files with spaces ' => [
270+ __DIR__ . '/../../../src/Command/CognitiveMetricsCommand.php, ' . __DIR__ . '/../../../src/Business/MetricsFacade.php, ' . __DIR__ . '/../../../src/Business/DirectoryScanner.php ' ,
271+ 'Command should succeed with multiple files and spaces '
272+ ],
273+ 'multiple directories ' => [
274+ __DIR__ . '/../../../src/Command, ' . __DIR__ . '/../../../src/Business ' ,
275+ 'Command should succeed with multiple directories '
276+ ],
277+ 'mixed paths ' => [
278+ __DIR__ . '/../../../src/Command, ' . __DIR__ . '/../../../src/Business/MetricsFacade.php ' ,
279+ 'Command should succeed with mixed directories and files '
280+ ],
281+ 'mixed paths with spaces ' => [
282+ __DIR__ . '/../../../src/Command, ' . __DIR__ . '/../../../src/Business/MetricsFacade.php, ' . __DIR__ . '/../../../src/Business/DirectoryScanner.php ' ,
283+ 'Command should succeed with mixed paths and spaces '
284+ ],
285+ ];
286+ }
241287}
0 commit comments