standards = ['Generic'];
self::$config->sniffs = ['Generic.PHP.LowerCaseConstant'];
self::$ruleset = new Ruleset(self::$config);
self::$runner = new Runner();
self::$runner->config = self::$config;
// Simple file which won't have any errors against the above sniff.
$content = 'process();
}//end initializeConfigRulesetRunner()
/**
* Reset some flags between tests.
*
* @after
*
* @return void
*/
protected function resetObjectFlags()
{
self::$config->showProgress = true;
self::$fileWithoutErrorsOrWarnings->ignored = false;
}//end resetObjectFlags()
/**
* Destroy the Config object after the test to reset statics.
*
* @afterClass
*
* @return void
*/
public static function reset()
{
// Explicitly trigger __destruct() on the ConfigDouble to reset the Config statics.
// The explicit method call prevents potential stray test-local references to the $config object
// preventing the destructor from running the clean up (which without stray references would be
// automagically triggered when this object is destroyed, but we can't definitively rely on that).
self::$config->__destruct();
}//end reset()
/**
* Verify that if progress reporting is disabled, no progress dots will show.
*
* @return void
*/
public function testNoProgressIsShownWhenDisabled()
{
$this->expectOutputString('');
self::$config->showProgress = false;
for ($i = 1; $i <= 10; $i++) {
self::$runner->printProgress(self::$fileWithoutErrorsOrWarnings, 3, $i);
}
}//end testNoProgressIsShownWhenDisabled()
/**
* Verify ignored files will be marked with an "S" for "skipped".
*
* @return void
*/
public function testProgressDotSkippedFiles()
{
$nrOfFiles = 10;
$this->expectOutputString('.S.S.S.S.S 10 / 10 (100%)'.PHP_EOL);
for ($i = 1; $i <= $nrOfFiles; $i++) {
if (($i % 2) === 0) {
self::$fileWithoutErrorsOrWarnings->ignored = true;
} else {
self::$fileWithoutErrorsOrWarnings->ignored = false;
}
self::$runner->printProgress(self::$fileWithoutErrorsOrWarnings, $nrOfFiles, $i);
}
}//end testProgressDotSkippedFiles()
/**
* Verify the handling of the summary at the end of each line.
*
* @param int $nrOfFiles The number of files in the scan.
* @param string $expected The expected progress information output.
*
* @dataProvider dataEndOfLineSummary
*
* @return void
*/
public function testEndOfLineSummary($nrOfFiles, $expected)
{
$this->expectOutputString($expected);
for ($i = 1; $i <= $nrOfFiles; $i++) {
self::$runner->printProgress(self::$fileWithoutErrorsOrWarnings, $nrOfFiles, $i);
}
}//end testEndOfLineSummary()
/**
* Data provider.
*
* @return array