/** * @param PHP_CodeCoverage $coverage * @param string $target */ public function process(PHP_CodeCoverage $coverage, $target) { $target = PHP_CodeCoverage_Util::getDirectory($target); $files = $coverage->getSummary(); $commonPath = PHP_CodeCoverage_Util::reducePaths($files); $items = PHP_CodeCoverage_Util::buildDirectoryStructure($files); $root = new PHP_CodeCoverage_Report_HTML_Node_Directory($commonPath, NULL); $this->addItems($root, $items, $files); $this->renderDashboard($root, $target . 'index.dashboard.html', $this->options['title']); foreach ($root as $node) { if ($node instanceof PHP_CodeCoverage_Report_HTML_Node_Directory) { $this->renderDashboard($node, $target . PHP_CodeCoverage_Util::getSafeFilename($node->getId()) . '.dashboard.html', $node->getName(TRUE)); } } $root->render($target, $this->options['title'], $this->options['charset'], $this->options['lowUpperBound'], $this->options['highLowerBound'], $this->options['generator']); $this->copyFiles($target); }
/** * @covers PHP_CodeCoverage_Util::reducePaths */ public function testReducePaths3() { $files = array('/home/sb/Money/Money.php' => array()); $commonPath = PHP_CodeCoverage_Util::reducePaths($files); $this->assertEquals(array('Money.php' => array()), $files); $this->assertEquals('/home/sb/Money/', $commonPath); }