renderReport() public method

This method will be called when the engine has finished the source analysis phase.
public renderReport ( PHPMD\Report $report ) : void
$report PHPMD\Report
return void
Example #1
0
 /**
  * testRendererAddsProcessingErrorsToTextReport
  *
  * @return void
  */
 public function testRendererAddsProcessingErrorsToTextReport()
 {
     // Create a writer instance.
     $writer = new WriterStub();
     $errors = array(new ProcessingError('Failed for file "/tmp/foo.php".'), new ProcessingError('Failed for file "/tmp/bar.php".'), new ProcessingError('Failed for file "/tmp/baz.php".'));
     $report = $this->getReportMock(0);
     $report->expects($this->once())->method('getRuleViolations')->will($this->returnValue(new \ArrayIterator(array())));
     $report->expects($this->once())->method('getErrors')->will($this->returnValue(new \ArrayIterator($errors)));
     $renderer = new TextRenderer();
     $renderer->setWriter($writer);
     $renderer->start();
     $renderer->renderReport($report);
     $renderer->end();
     $this->assertEquals(PHP_EOL . "/tmp/foo.php\t-\tFailed for file \"/tmp/foo.php\"." . PHP_EOL . "/tmp/bar.php\t-\tFailed for file \"/tmp/bar.php\"." . PHP_EOL . "/tmp/baz.php\t-\tFailed for file \"/tmp/baz.php\"." . PHP_EOL, $writer->getData());
 }