示例#1
0
 /**
  * {@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 testHasMinorViolations_withMinorViolations_isTrue()
 {
     $this->report->minor($this->violation('test'));
     $this->assertTrue($this->report->hasMinorViolations());
 }