/** * {@inheritdoc} */ public function write(PolicyViolationReport $report) { if (!$report->hasViolations()) { $this->out->writeln("<info>No policy violations found!</info>"); return; } if ($report->hasMajorViolations()) { $this->out->writeln(sprintf("<error>%d major policy violations found!</error>", count($report->getMajorViolations()))); $this->printViolations($report->getMajorViolations()); } if ($report->hasMinorViolations()) { $this->out->writeln(sprintf("<error>%d minor policy violations found!</error>", count($report->getMinorViolations()))); $this->printViolations($report->getMinorViolations()); } if ($report->hasUndefinedViolations()) { $this->out->writeln(sprintf("<error>%d relations have no policy defined!</error>", count($report->getUndefinedViolations()))); $this->printViolations($report->getUndefinedViolations()); } }
public function testHasUndefinedViolations_withIgnoreUndefined_isFalse() { $this->report = new PolicyViolationReport(false); $this->report->undefined($this->violation('test')); $this->assertFalse($this->report->hasUndefinedViolations()); }