/** * Creates the PDepend summary report for the source associated with the * calling test case. * * @return string * @since 0.10.0 */ protected function createSummaryXmlForCallingTest() { $this->changeWorkingDirectory($this->createCodeResourceURI('config/')); $file = self::createRunResourceURI('summary.xml'); $log = new Xml(); $log->setLogFile($file); $pdepend = $this->createEngineFixture(); $pdepend->addFile(self::createCodeResourceUriForTest()); $pdepend->addReportGenerator($log); $pdepend->analyze(); return $file; }
/** * testNodeAwareAnalyzer * * @return void */ public function testNodeAwareAnalyzer() { $this->namespaces = self::parseCodeResourceForTest(); $input = array(array('loc' => 42), array('ncloc' => 23), array('loc' => 9), array('ncloc' => 7), array('loc' => 101), array('ncloc' => 99), array('loc' => 90), array('ncloc' => 80), array('loc' => 50), array('ncloc' => 45), array('loc' => 30), array('ncloc' => 22), array('loc' => 9), array('ncloc' => 9), array('loc' => 3), array('ncloc' => 3), array('loc' => 42), array('ncloc' => 23), array('loc' => 33), array('ncloc' => 20), array('loc' => 9), array('ncloc' => 7)); $metricsOne = array(); $metricsTwo = array(); foreach ($this->namespaces as $namespace) { $metricsOne[$namespace->getId()] = array_shift($input); $metricsTwo[$namespace->getId()] = array_shift($input); foreach ($namespace->getClasses() as $class) { $metricsOne[$class->getId()] = array_shift($input); $metricsTwo[$class->getId()] = array_shift($input); foreach ($class->getMethods() as $method) { $metricsOne[$method->getId()] = array_shift($input); $metricsTwo[$method->getId()] = array_shift($input); } } foreach ($namespace->getFunctions() as $function) { $metricsOne[$function->getId()] = array_shift($input); $metricsTwo[$function->getId()] = array_shift($input); } } $resultOne = new AnalyzerNodeAwareDummy($metricsOne); $resultTwo = new AnalyzerNodeAwareDummy($metricsTwo); $log = new Xml(); $log->setLogFile($this->resultFile); $log->setArtifacts($this->namespaces); $log->log($resultOne); $log->log($resultTwo); $log->close(); $fileName = 'node-aware-result-set.xml'; $this->assertXmlStringEqualsXmlString($this->getNormalizedPathXml(dirname(__FILE__) . "/_expected/{$fileName}"), $this->getNormalizedPathXml($this->resultFile)); }