public function testHasViolations_withAllViolations_isTrue()
 {
     $this->report->major($this->violation('test'));
     $this->report->minor($this->violation('test'));
     $this->report->undefined($this->violation('test'));
     $this->assertTrue($this->report->hasViolations());
 }
Пример #2
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());
     }
 }