public function testGetMinorViolations_withMinorViolations_returnsViolations()
 {
     // add violations
     $this->report->minor($this->violation('test'));
     $this->report->minor($this->violation('test'));
     $this->report->minor($this->violation('test'));
     $this->report->minor($this->violation('foo'));
     $violations = $this->report->getMinorViolations();
     $this->assertArrayHasKey('test', $violations);
     $this->assertArrayHasKey('foo', $violations);
     $this->assertCount(2, $violations);
     $this->assertCount(3, $violations['test']);
     $this->assertCount(1, $violations['foo']);
 }
 /**
  * {@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());
     }
 }