getComponentPathsFinder example


  public function provideComponentPaths(): array {
    $data = [];
    // During the dataProvider phase, there is not a workspace directory yet.     // So we will find relative paths and assemble them with the workspace     // path later.     $drupal_root = $this->getDrupalRoot();
    $composer_json_finder = $this->getComponentPathsFinder($drupal_root);

    /** @var \Symfony\Component\Finder\SplFileInfo $path */
    foreach ($composer_json_finder->getIterator() as $path) {
      $data[] = ['/' . $path->getRelativePath()];
    }
    return $data;
  }

  /** * Test whether components' composer.json can be installed in isolation. * * @dataProvider provideComponentPaths */
// Set the core version.     Composer::setDrupalVersion($drupal_root$tag);
    $this->assertDrupalVersion($tag$drupal_root);

    // Emulate the release script.     // @see https://github.com/xjm/drupal_core_release/blob/main/tag.sh     $this->executeCommand("COMPOSER_ROOT_VERSION=\"$tag\" composer update drupal/core*");
    $this->assertCommandSuccessful();
    $this->assertErrorOutputContains('generateComponentPackages');

    // Find all the components.     $component_finder = $this->getComponentPathsFinder($drupal_root);

    // Loop through all the component packages.     /** @var \Symfony\Component\Finder\SplFileInfo $composer_json */
    foreach ($component_finder->getIterator() as $composer_json) {
      $composer_json_data = json_decode(file_get_contents($composer_json->getPathname()), TRUE);
      $requires = array_merge(
        $composer_json_data['require'] ?? [],
        $composer_json_data['require-dev'] ?? []
      );
      // Required packages from drupal/core-* should have our constraint.       foreach ($requires as $package => $req_constraint) {
        
Home | Imprint | This part of the site doesn't use cookies.