function BuildTestBase::getCodebaseFinder

Same name in other branches
  1. 9 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::getCodebaseFinder()
  2. 8.9.x core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::getCodebaseFinder()
  3. 11.x core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::getCodebaseFinder()

Get a default Finder object for a Drupal codebase.

This method can be used two ways:

  • Override this method and provide your own default Finder object for copyCodebase().
  • Call the method to get a default Finder object which can then be modified for other purposes.

Note that the vendor directory is deliberately not included in the directory exclusions here, so that packages are copied and composer does not attempt to download them from packagist/github during test runs.

Return value

\Symfony\Component\Finder\Finder A Finder object ready to iterate over core codebase.

File

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

Class

BuildTestBase
Provides a workspace to test build processes.

Namespace

Drupal\BuildTests\Framework

Code

public function getCodebaseFinder() {
    $drupal_root = $this->getWorkingPathDrupalRoot() ?? '';
    $finder = new Finder();
    $finder->files()
        ->followLinks()
        ->ignoreUnreadableDirs()
        ->in($this->getComposerRoot())
        ->notPath("#^{$drupal_root}sites/default/files#")
        ->notPath("#^{$drupal_root}sites/simpletest#")
        ->notPath("#^{$drupal_root}core/node_modules#")
        ->notPath("#^{$drupal_root}sites/default/settings\\..*php#")
        ->ignoreDotFiles(FALSE)
        ->ignoreVCS(FALSE);
    return $finder;
}

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