Skip to content

Commit

Permalink
Add test to protect from regression
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed May 13, 2024
1 parent 6005421 commit 0278526
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/Core/ErrorSuppressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1275,4 +1275,31 @@ public static function dataCommenting()
}//end dataCommenting()


/**
* Ensure that when the cache is enabled, and we are recording error messages, issues with serverity=0 are not included in the results.
*
* @return void
*/
public function testErrorSeverityZeroWithCacheEnabled()
{
$config = new ConfigDouble();
$config->standards = ['Generic'];
$config->sniffs = ['Generic.PHP.LowerCaseConstant'];
$config->cache = true;
$config->recordErrors = true;

$ruleset = new Ruleset($config);
$ruleset->ruleset['Generic.PHP.LowerCaseConstant.Found']['severity'] = 0;

$content = '<?php $var = FALSE;';

$file = new DummyFile($content, $ruleset, $config);
$file->process();

$this->assertSame(0, $file->getErrorCount());
$this->assertSame([], $file->getErrors());

}//end testErrorSeverityZeroWithCacheEnabled()


}//end class

0 comments on commit 0278526

Please sign in to comment.