function RecipeTestTrait::runDrupalCommand

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeTestTrait.php \Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait::runDrupalCommand()

Runs the `core/scripts/drupal` script with the given arguments.

Parameters

array<string|int> $arguments: The arguments and options to pass to the script.

int $timeout: (optional) How long the command should run before timing out, in seconds. Defaults to 500.

Return value

\Symfony\Component\Process\Process The started process.

8 calls to RecipeTestTrait::runDrupalCommand()
ContentExportTest::doTestCircularDependency in core/tests/Drupal/FunctionalTests/DefaultContent/ContentExportTest.php
Tests that the exporter handles circular dependencies gracefully.
ContentExportTest::doTestExportedPasswordIsPreserved in core/tests/Drupal/FunctionalTests/DefaultContent/ContentExportTest.php
Tests that an exported user account can be logged in with after import.
ContentExportTest::doTestExportEntitiesFilteredByType in core/tests/Drupal/FunctionalTests/DefaultContent/ContentExportTest.php
Tests exporting entities filtered by type.
ContentExportTest::doTestExportSingleEntityToDirectory in core/tests/Drupal/FunctionalTests/DefaultContent/ContentExportTest.php
Tests exporting a single entity to a directory with attachments.
ContentExportTest::doTestExportWithDependencies in core/tests/Drupal/FunctionalTests/DefaultContent/ContentExportTest.php
Tests exporting a piece of content with its dependencies.

... See full list

File

core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeTestTrait.php, line 97

Class

RecipeTestTrait
Contains helper methods for interacting with recipes in functional tests.

Namespace

Drupal\FunctionalTests\Core\Recipe

Code

protected function runDrupalCommand(array $arguments, int $timeout = 500) : Process {
  assert($this instanceof BrowserTestBase);
  array_unshift($arguments, (new PhpExecutableFinder())->find(), 'core/scripts/drupal');
  $process = (new Process($arguments))->setWorkingDirectory($this->getDrupalRoot())
    ->setEnv([
    'DRUPAL_DEV_SITE_PATH' => $this->siteDirectory,
    // Ensure that the command boots Drupal into a state where it knows it's
    // a test site.
    // @see drupal_valid_test_ua()
'HTTP_USER_AGENT' => drupal_generate_test_ua($this->databasePrefix),
  ])
    ->setTimeout($timeout);
  $process->run();
  return $process;
}

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