You are here

public function BuildTestBase::copyCodebase in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::copyCodebase()

Copy the current working codebase into a workspace.

Use this method to copy the current codebase, including any patched changes, into the workspace.

By default, the copy will exclude sites/default/settings.php, sites/default/files, and vendor/. Use the $iterator parameter to override this behavior.

Parameters

\Iterator|null $iterator: (optional) An iterator of all the files to copy. Default behavior is to exclude site-specific directories and files.

string|null $working_dir: (optional) Relative path within the test workspace file system that will contain the copy of the codebase. Defaults to the workspace directory.

5 calls to BuildTestBase::copyCodebase()
BuildTestTest::testCopyCodebase in core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php
@covers ::copyCodebase
BuildTestTest::testPortMany in core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php
@covers ::findAvailablePort
ComposerProjectTemplatesTest::testTemplateCreateProject in core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
@dataProvider provideTemplateCreateProject
GenerateThemeTest::setUp in core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php
HtRouterTest::testHtRouter in core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php
@covers ::instantiateServer

File

core/tests/Drupal/BuildTests/Framework/BuildTestBase.php, line 543

Class

BuildTestBase
Provides a workspace to test build processes.

Namespace

Drupal\BuildTests\Framework

Code

public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL) {
  $working_path = $this
    ->getWorkingPath($working_dir);
  if ($iterator === NULL) {
    $iterator = $this
      ->getCodebaseFinder()
      ->getIterator();
  }
  $fs = new SymfonyFilesystem();
  $options = [
    'override' => TRUE,
    'delete' => FALSE,
  ];
  $fs
    ->mirror($this
    ->getDrupalRoot(), $working_path, $iterator, $options);
}