/** * Get letter to display progress (having analyzed one file), * E on lint error, F for failed checks, . for successful check * * @param string $file File that was analyzed * @param Result $result Result object * @return string */ protected function getProgressLetter($file, Result $result) { if ($result->wasSkipped($file)) { return 'S'; } if ($result->hasLintError($file)) { return 'E'; } if ($result->hasRuleError($file)) { return 'E'; } if ($result->hasViolations($file)) { return 'F'; } return '.'; }
/** * @covers spriebsch\PHPca\Result::hasViolations */ public function testHasViolationsForFile() { $result = new Result(); $result->addFile('testfile'); $result->addMessage(new Violation('testfile', 'error message')); $this->assertTrue($result->hasViolations('testfile')); }