function UnpackRecipeTest::runComposer

Executes a Composer command with standard options.

Parameters

string $command: The composer command to execute.

string $cwd: The current working directory to run the command from.

string $error_output: Passed by reference to allow error output to be tested.

Return value

string Standard output from the command.

15 calls to UnpackRecipeTest::runComposer()
UnpackRecipeTest::doTestRecipeAUnpacked in core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
Tests Recipe A is unpacked correctly.
UnpackRecipeTest::testAutomaticUnpack in core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
Tests the dependencies unpack on install.
UnpackRecipeTest::testComposerCreateProject in core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
Tests that recipes are unpacked when using `composer create-project`.
UnpackRecipeTest::testIgnoreDependentRecipe in core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
Tests a dependent recipe can be ignored and not unpacked.
UnpackRecipeTest::testIgnoreRecipe in core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
Tests a recipe can be ignored and not unpacked.

... See full list

File

core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php, line 651

Class

UnpackRecipeTest
Tests recipe unpacking.

Namespace

Drupal\Tests\Composer\Plugin\Unpack\Functional

Code

private function runComposer(string $command, ?string $cwd = NULL, string &$error_output = '') : string {
    $cwd ??= $this->fixturesDir . '/composer-root';
    // Always add --no-interaction and --no-ansi to Composer commands.
    $output = $this->mustExec("composer {$command} --no-interaction --no-ansi", $cwd, [], $error_output);
    if ($command === 'install') {
        $this->assertFileExists($cwd . '/composer.lock');
    }
    return $output;
}

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