diff --git a/src/Command/RunCommand.php b/src/Command/RunCommand.php index 852b275..7d139cc 100644 --- a/src/Command/RunCommand.php +++ b/src/Command/RunCommand.php @@ -235,6 +235,11 @@ private function createOption(InputInterface $input): Option private function getCSVOption(InputInterface $input, string $option): array { $result = $input->getOption($option); + + if (null === $result) { + return []; + } + if (false === is_array($result)) { return array_filter( explode(',', (string) $result), @@ -244,9 +249,6 @@ static function ($value) { ); } - if (null === $result) { - return []; - } return $result; } diff --git a/tests/Command/RunCommandTest.php b/tests/Command/RunCommandTest.php index 3662e9e..f2392bb 100644 --- a/tests/Command/RunCommandTest.php +++ b/tests/Command/RunCommandTest.php @@ -67,6 +67,14 @@ public function testItDoesNotFailCommandWhenFileOnPathDoesNotExist(): void ]); $this->assertSame(RunCommand::SUCCESS, $this->commandTester->getStatusCode()); - $this->assertRegExp('/No files found to scan/i', $this->commandTester->getDisplay()); + $output = $this->commandTester->getDisplay(); + + /* This should use assertStringContainsString but the lowest phpunit supported does not allow that */ + $found = false; + if (strpos($output, 'No files found to scan') !== false) { + $found = true; + } + + $this->assertTrue($found); } } diff --git a/tests/Printer/XmlTest.php b/tests/Printer/XmlTest.php index c66edf5..5606f38 100644 --- a/tests/Printer/XmlTest.php +++ b/tests/Printer/XmlTest.php @@ -17,7 +17,6 @@ class XmlTest extends TestCase public function testEmpty() : void { $outputPath = tempnam(sys_get_temp_dir(), 'phpmnd_'); - $xmlPrinter = new Xml($outputPath); $xmlPrinter->printData(new NullOutput(), new HintList(), []);