function ComponentsIsolatedBuildTest::testComponentComposerJson

Same name and namespace in other branches
  1. 9 core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php \Drupal\BuildTests\Composer\Component\ComponentsIsolatedBuildTest::testComponentComposerJson()
  2. 10 core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php \Drupal\BuildTests\Composer\Component\ComponentsIsolatedBuildTest::testComponentComposerJson()

Test whether components' composer.json can be installed in isolation.

@dataProvider provideComponentPaths

File

core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php, line 48

Class

ComponentsIsolatedBuildTest
Try to install dependencies per component, using Composer.

Namespace

Drupal\BuildTests\Composer\Component

Code

public function testComponentComposerJson(string $component_path) : void {
    // Only copy the components. Copy all of them because some of them depend on
    // each other.
    $finder = new Finder();
    $finder->files()
        ->ignoreUnreadableDirs()
        ->in($this->getDrupalRoot() . static::$componentsPath)
        ->ignoreDotFiles(FALSE)
        ->ignoreVCS(FALSE);
    $this->copyCodebase($finder->getIterator());
    $working_dir = $this->getWorkingPath() . static::$componentsPath . $component_path;
    // We add path repositories so we can wire internal dependencies together.
    $this->addExpectedRepositories($working_dir);
    // Perform the installation.
    $this->executeCommand("composer install --working-dir={$working_dir} --no-interaction --no-progress");
    $this->assertCommandSuccessful();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.