Author: Manuel Pichler (mapi@phpmd.org)
Inheritance: extends PHPMD\AbstractRenderer
 /**
  * testLocalVariableUsedInDoubleQuoteStringGetsNotReported
  *
  * @return void
  * @outputBuffering enabled
  */
 public function testLocalVariableUsedInDoubleQuoteStringGetsNotReported()
 {
     $renderer = new TextRenderer();
     $renderer->setWriter(new StreamWriter(self::createTempFileUri()));
     $inputs = self::createCodeResourceUriForTest();
     $rules = 'unusedcode';
     $renderes = array($renderer);
     $factory = new RuleSetFactory();
     $phpmd = new PHPMD();
     $phpmd->processFiles($inputs, $rules, $renderes, $factory);
 }
示例#2
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());
 }