Esempio n. 1
0
 /**
  * testNodeAwareAnalyzer
  *
  * @return void
  */
 public function testNodeAwareAnalyzer()
 {
     $this->packages = 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->packages as $package) {
         $metricsOne[$package->getUUID()] = array_shift($input);
         $metricsTwo[$package->getUUID()] = array_shift($input);
         foreach ($package->getClasses() as $class) {
             $metricsOne[$class->getUUID()] = array_shift($input);
             $metricsTwo[$class->getUUID()] = array_shift($input);
             foreach ($class->getMethods() as $method) {
                 $metricsOne[$method->getUUID()] = array_shift($input);
                 $metricsTwo[$method->getUUID()] = array_shift($input);
             }
         }
         foreach ($package->getFunctions() as $function) {
             $metricsOne[$function->getUUID()] = array_shift($input);
             $metricsTwo[$function->getUUID()] = array_shift($input);
         }
     }
     $resultOne = new PHP_Depend_Log_Summary_AnalyzerNodeAwareDummy($metricsOne);
     $resultTwo = new PHP_Depend_Log_Summary_AnalyzerNodeAwareDummy($metricsTwo);
     $log = new PHP_Depend_Log_Summary_Xml();
     $log->setLogFile($this->resultFile);
     $log->setCode($this->packages);
     $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));
 }