Skip to content

Commit 0278526

Browse files
committed
Add test to protect from regression
1 parent 6005421 commit 0278526

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/Core/ErrorSuppressionTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,4 +1275,31 @@ public static function dataCommenting()
12751275
}//end dataCommenting()
12761276

12771277

1278+
/**
1279+
* Ensure that when the cache is enabled, and we are recording error messages, issues with serverity=0 are not included in the results.
1280+
*
1281+
* @return void
1282+
*/
1283+
public function testErrorSeverityZeroWithCacheEnabled()
1284+
{
1285+
$config = new ConfigDouble();
1286+
$config->standards = ['Generic'];
1287+
$config->sniffs = ['Generic.PHP.LowerCaseConstant'];
1288+
$config->cache = true;
1289+
$config->recordErrors = true;
1290+
1291+
$ruleset = new Ruleset($config);
1292+
$ruleset->ruleset['Generic.PHP.LowerCaseConstant.Found']['severity'] = 0;
1293+
1294+
$content = '<?php $var = FALSE;';
1295+
1296+
$file = new DummyFile($content, $ruleset, $config);
1297+
$file->process();
1298+
1299+
$this->assertSame(0, $file->getErrorCount());
1300+
$this->assertSame([], $file->getErrors());
1301+
1302+
}//end testErrorSeverityZeroWithCacheEnabled()
1303+
1304+
12781305
}//end class

0 commit comments

Comments
 (0)