Commit cd1325c3 authored by alexpott's avatar alexpott

Issue #3095809 by Mile23, joachim: Add a factory method for BuildTestBase's...

Issue #3095809 by Mile23, joachim: Add a factory method for BuildTestBase's copyCodebase() Finder object
parent df1a2b06
......@@ -547,17 +547,7 @@ public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL) {
$working_path = $this->getWorkingPath($working_dir);
if ($iterator === NULL) {
$finder = new Finder();
$finder->files()
->ignoreUnreadableDirs()
->in($this->getDrupalRoot())
->notPath('#^sites/default/files#')
->notPath('#^sites/simpletest#')
->notPath('#^vendor#')
->notPath('#^sites/default/settings\..*php#')
->ignoreDotFiles(FALSE)
->ignoreVCS(FALSE);
$iterator = $finder->getIterator();
$iterator = $this->getCodebaseFinder()->getIterator();
}
$fs = new SymfonyFilesystem();
......@@ -565,6 +555,32 @@ public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL) {
$fs->mirror($this->getDrupalRoot(), $working_path, $iterator, $options);
}
/**
* 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.
*
* @return \Symfony\Component\Finder\Finder
* A Finder object ready to iterate over core codebase.
*/
public function getCodebaseFinder() {
$finder = new Finder();
$finder->files()
->ignoreUnreadableDirs()
->in($this->getDrupalRoot())
->notPath('#^sites/default/files#')
->notPath('#^sites/simpletest#')
->notPath('#^vendor#')
->notPath('#^sites/default/settings\..*php#')
->ignoreDotFiles(FALSE)
->ignoreVCS(FALSE);
return $finder;
}
/**
* Get the root path of this Drupal codebase.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment