function ComposerIntegrationTest::createProjectRoot

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php \Drupal\Tests\Composer\ComposerIntegrationTest::createProjectRoot()

Creates a virtual project root with an optional composer.json.

Parameters

array|null $composer: The decoded composer.json contents, or NULL to omit the file.

Return value

string The URL of the virtual project root.

File

core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php, line 61

Class

ComposerIntegrationTest
Tests Composer integration.

Namespace

Drupal\Tests\Composer

Code

protected function createProjectRoot(?array $composer) : string {
  $structure = [];
  if ($composer !== NULL) {
    $structure['composer.json'] = json_encode($composer);
  }
  return vfsStream::setup('project', NULL, $structure)->url();
}

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