Example #1
0
 /**
  * Template method. Prepare data step
  *
  * @param \Magento\Tools\Dependency\Report\Circular\Data\Config $config
  * @return array
  */
 protected function prepareData($config)
 {
     $data[] = ['Circular dependencies:', 'Total number of chains'];
     $data[] = ['', $config->getDependenciesCount()];
     $data[] = [];
     if ($config->getDependenciesCount()) {
         $data[] = ['Circular dependencies for each module:', ''];
         foreach ($config->getModules() as $module) {
             $data[] = [$module->getName(), $module->getChainsCount()];
             foreach ($module->getChains() as $chain) {
                 $data[] = [implode(self::MODULES_SEPARATOR, $chain->getModules())];
             }
             $data[] = [];
         }
     }
     array_pop($data);
     return $data;
 }
Example #2
0
 public function testGetDependenciesCount()
 {
     $this->moduleFirst->expects($this->once())->method('getChainsCount')->will($this->returnValue(0));
     $this->moduleSecond->expects($this->once())->method('getChainsCount')->will($this->returnValue(2));
     $this->assertEquals(2, $this->config->getDependenciesCount());
 }