From 32ecc588e293a653617a96e673772419f5271466 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 7 May 2021 14:17:32 +0200 Subject: [PATCH] ErrorSuppressionTest: fix bug in testSuppressScope() As the "no suppression" test would yield no errors, the test wasn't actually testing anything as there were no errors to suppress. Fixed now by using a different sniff to test against, which does yield an error on the line being suppressed by the rest of the tests. --- tests/Core/ErrorSuppressionTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Core/ErrorSuppressionTest.php b/tests/Core/ErrorSuppressionTest.php index 7d392ce55d..09616d3bc1 100644 --- a/tests/Core/ErrorSuppressionTest.php +++ b/tests/Core/ErrorSuppressionTest.php @@ -579,7 +579,7 @@ public function testSuppressScope() { $config = new Config(); $config->standards = ['PEAR']; - $config->sniffs = ['PEAR.NamingConventions.ValidVariableName']; + $config->sniffs = ['PEAR.Functions.FunctionDeclaration']; $ruleset = new Ruleset($config); @@ -590,8 +590,8 @@ public function testSuppressScope() $errors = $file->getErrors(); $numErrors = $file->getErrorCount(); - $this->assertEquals(0, $numErrors); - $this->assertCount(0, $errors); + $this->assertEquals(1, $numErrors); + $this->assertCount(1, $errors); // Process with suppression. $content = 'foo();'.PHP_EOL.'}'.PHP_EOL.'}';