function ComposerIntegrationTest::createProjectRoot

Same name and namespace in other branches
  1. main 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.

5 calls to ComposerIntegrationTest::createProjectRoot()
ComposerIntegrationTest::testAbsoluteBinDir in core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php
Tests that an absolute bin-dir is returned unchanged.
ComposerIntegrationTest::testBinDir in core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php
Tests bin dir resolution against composer.json contents.
ComposerIntegrationTest::testEmptyEnvironmentVariableIgnored in core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php
Tests that an empty COMPOSER_BIN_DIR environment variable is ignored.
ComposerIntegrationTest::testEnvironmentVariableOverride in core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php
Tests that the COMPOSER_BIN_DIR environment variable takes precedence.
ComposerIntegrationTest::testWindowsAbsoluteBinDir in core/tests/Drupal/Tests/Composer/ComposerIntegrationTest.php
Tests that a Windows-style absolute bin-dir is returned unchanged.

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.