Commit 8d8963f2 authored by alexpott's avatar alexpott

Issue #3088400 by heddn, Mile23: BuildTestBase->copyCodebase overly aggressive in exclusions

(cherry picked from commit 3b6698e9)
parent 58faaf53
......@@ -542,13 +542,12 @@ public function copyCodebase(\Iterator $iterator = NULL, $working_dir = NULL) {
if ($iterator === NULL) {
$finder = new Finder();
$finder->files()
->ignoreUnreadableDirs()
->in($this->getDrupalRoot())
->exclude([
'sites/default/files',
'sites/simpletest',
'vendor',
])
->notPath('/sites\/default\/settings\..*php/')
->notPath('#^sites/default/files#')
->notPath('#^sites/simpletest#')
->notPath('#^vendor#')
->notPath('#^sites/default/settings\..*php#')
->ignoreDotFiles(FALSE)
->ignoreVCS(FALSE);
$iterator = $finder->getIterator();
......
......@@ -4,6 +4,7 @@
use Drupal\BuildTests\Framework\BuildTestBase;
use org\bovigo\vfs\vfsStream;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
/**
......@@ -56,8 +57,8 @@ public function testCopyCodebase() {
* @covers ::copyCodebase
*/
public function testCopyCodebaseExclude() {
// Create a virtual file system containing only items that should be
// excluded.
// Create a virtual file system containing items that should be
// excluded. Exception being modules directory.
vfsStream::setup('drupal', NULL, [
'sites' => [
'default' => [
......@@ -65,6 +66,7 @@ public function testCopyCodebaseExclude() {
'a_file.txt' => 'some file.',
],
'settings.php' => '<?php $settings = stuff;',
'settings.local.php' => '<?php $settings = override;',
],
'simpletest' => [
'simpletest_hash' => [
......@@ -79,6 +81,15 @@ public function testCopyCodebaseExclude() {
],
],
],
'modules' => [
'my_module' => [
'vendor' => [
'my_vendor' => [
'composer.json' => "{\n}",
],
],
],
],
]);
// Mock BuildTestBase so that it thinks our VFS is the Drupal root.
......@@ -98,6 +109,13 @@ public function testCopyCodebaseExclude() {
$full_path = $base->getWorkspaceDirectory() . '/' . $test_directory;
$this->assertDirectoryExists($full_path);
// Verify nested vendor directory was not excluded. Then remove it for next
// validation.
$this->assertFileExists($full_path . DIRECTORY_SEPARATOR . 'modules/my_module/vendor/my_vendor/composer.json');
$file_system = new Filesystem();
$file_system->remove($full_path . DIRECTORY_SEPARATOR . 'modules');
// Use scandir() to determine if our target directory is empty. It should
// only contain the system dot directories.
$this->assertTrue(
......
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