Ejemplo n.º 1
0
 public function testComponentPathsInRoot()
 {
     if (!isset(self::$rootJson['extra']) || !isset(self::$rootJson['extra']['component_paths'])) {
         $this->markTestSkipped("The root composer.json file doesn't mention any extra component paths information");
     }
     $this->assertArrayHasKey('replace', self::$rootJson, "If there are any component paths specified, then they must be reflected in 'replace' section");
     $flat = $this->getFlatPathsInfo(self::$rootJson['extra']['component_paths']);
     while (list(, list($component, $path)) = each($flat)) {
         $this->assertFileExists(self::$root . '/' . $path, "Missing or invalid component path: {$component} -> {$path}");
         $this->assertArrayHasKey($component, self::$rootJson['replace'], "The {$component} is specified in 'extra->component_paths', but missing in 'replace' section");
     }
     foreach (array_keys(self::$rootJson['replace']) as $replace) {
         if (!MagentoComponent::matchMagentoComponent($replace)) {
             $this->assertArrayHasKey($replace, self::$rootJson['extra']['component_paths'], "The {$replace} is specified in 'replace', but missing in 'extra->component_paths' section");
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @return void
  */
 private function checkProject()
 {
     sort(self::$dependencies);
     $dependenciesListed = [];
     if (strpos(self::$rootJson['name'], 'magento/project-') !== 0) {
         $this->assertArrayHasKey('replace', (array) self::$rootJson, 'No "replace" section found in root composer.json');
         foreach (array_keys((array) self::$rootJson['replace']) as $key) {
             if (MagentoComponent::matchMagentoComponent($key)) {
                 $dependenciesListed[] = $key;
             }
         }
         sort($dependenciesListed);
         $nonDeclaredDependencies = array_diff(self::$dependencies, $dependenciesListed);
         $nonexistentDependencies = array_diff($dependenciesListed, self::$dependencies);
         $this->assertEmpty($nonDeclaredDependencies, 'Following dependencies are not declared in the root composer.json: ' . join(', ', $nonDeclaredDependencies));
         $this->assertEmpty($nonexistentDependencies, 'Following dependencies declared in the root composer.json do not exist: ' . join(', ', $nonexistentDependencies));
     }
 }