diff --git a/tests/Command/CodeCheckerCommandTest.php b/tests/Command/CodeCheckerCommandTest.php index 07932f85..e27960e9 100644 --- a/tests/Command/CodeCheckerCommandTest.php +++ b/tests/Command/CodeCheckerCommandTest.php @@ -48,6 +48,16 @@ protected function executeCommand($pluginDir = null, array $options = []): Comma $options = array_merge(['plugin' => $pluginDir], $options); + // We have to, always, exclude the moodle.Commenting.Package sniff because validation is + // not aware of the moodle components and we don't want to complicate things + // too much. Ir real executions, proper components are detected. + // TODO: If the Sniff is fixed to stop reporting components as correct ones, delete this. + if (!empty($options['--exclude'])) { + $options['--exclude'] .= ',moodle.Commenting.Package'; + } else { + $options['--exclude'] = 'moodle.Commenting.Package'; + } + $commandTester = new CommandTester($application->find('codechecker')); $commandTester->execute($options); diff --git a/tests/Command/CodeFixerCommandTest.php b/tests/Command/CodeFixerCommandTest.php index 33231096..98254d74 100644 --- a/tests/Command/CodeFixerCommandTest.php +++ b/tests/Command/CodeFixerCommandTest.php @@ -76,10 +76,18 @@ public function testExecute() // Verify various parts of the output. $output = $commandTester->getDisplay(); - $this->assertMatchesRegularExpression('/F\.* 10\.* \/ 10 \(100%\)/', $output); // Progress. + // We have to account here all the moodle.Commenting.Package errors being reported + // because validation is not aware of the components and we don't want to complicate things + // too much. Ir real executions, proper components are detected. + // TODO: If the Sniff is fixed to stop reporting components as correct ones, switch back to commented lines. + $this->assertMatchesRegularExpression('/FF* 10\.* \/ 10 \(100%\)/', $output); // Progress. $this->assertMatchesRegularExpression('/\/fixable.php/', $output); // File. - $this->assertMatchesRegularExpression('/A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE/', $output); // Summary. + $this->assertMatchesRegularExpression('/A TOTAL OF 10 ERRORS WERE FIXED IN 10 FILES/', $output); // Summary. $this->assertMatchesRegularExpression('/Time:.*Memory:/', $output); // Time. + // $this->assertMatchesRegularExpression('/F\.* 10\.* \/ 10 \(100%\)/', $output); // Progress. + // $this->assertMatchesRegularExpression('/\/fixable.php/', $output); // File. + // $this->assertMatchesRegularExpression('/A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE/', $output); // Summary. + // $this->assertMatchesRegularExpression('/Time:.*Memory:/', $output); // Also verify display info is correct. $this->assertMatchesRegularExpression('/RUN Code Beautifier and Fixer/', $commandTester->getDisplay());