예제 #1
0
 public function testGetModuleName()
 {
     $this->assertEquals('A', $this->packageInfo->getModuleName('a'));
     $this->assertEquals('B', $this->packageInfo->getModuleName('b'));
     $this->assertEquals('C', $this->packageInfo->getModuleName('c'));
     $this->assertEquals('D', $this->packageInfo->getModuleName('d'));
     $this->assertEquals('E', $this->packageInfo->getModuleName('e'));
     $this->assertEquals('Magento_TestModuleName', $this->packageInfo->getModuleName('magento/module-test-module-name'));
     $this->assertArrayHasKey('Magento_TestModuleName', $this->packageInfo->getNonExistingDependencies());
 }
 /**
  * Create the dependency graph
  *
  * @return Graph
  */
 private function createGraph()
 {
     $nodes = [];
     $dependencies = [];
     // build the graph data
     foreach (array_keys($this->fullModuleList) as $moduleName) {
         $nodes[] = $moduleName;
         foreach ($this->packageInfo->getRequire($moduleName) as $dependModuleName) {
             if ($dependModuleName) {
                 $dependencies[] = [$moduleName, $dependModuleName];
             }
         }
     }
     $nodes = array_unique(array_merge($nodes, $this->packageInfo->getNonExistingDependencies()));
     return new Graph($nodes, $dependencies);
 }