Issue #3088400 by heddn, Mile23: BuildTestBase->copyCodebase overly aggressive in exclusions
(cherry picked from commit 3b6698e973
)
merge-requests/64/head
parent
2a58c7ef79
commit
aa9d5a31dd
|
@ -547,13 +547,12 @@ abstract class BuildTestBase extends TestCase {
|
||||||
if ($iterator === NULL) {
|
if ($iterator === NULL) {
|
||||||
$finder = new Finder();
|
$finder = new Finder();
|
||||||
$finder->files()
|
$finder->files()
|
||||||
|
->ignoreUnreadableDirs()
|
||||||
->in($this->getDrupalRoot())
|
->in($this->getDrupalRoot())
|
||||||
->exclude([
|
->notPath('#^sites/default/files#')
|
||||||
'sites/default/files',
|
->notPath('#^sites/simpletest#')
|
||||||
'sites/simpletest',
|
->notPath('#^vendor#')
|
||||||
'vendor',
|
->notPath('#^sites/default/settings\..*php#')
|
||||||
])
|
|
||||||
->notPath('/sites\/default\/settings\..*php/')
|
|
||||||
->ignoreDotFiles(FALSE)
|
->ignoreDotFiles(FALSE)
|
||||||
->ignoreVCS(FALSE);
|
->ignoreVCS(FALSE);
|
||||||
$iterator = $finder->getIterator();
|
$iterator = $finder->getIterator();
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Drupal\BuildTests\Framework\Tests;
|
||||||
|
|
||||||
use Drupal\BuildTests\Framework\BuildTestBase;
|
use Drupal\BuildTests\Framework\BuildTestBase;
|
||||||
use org\bovigo\vfs\vfsStream;
|
use org\bovigo\vfs\vfsStream;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,8 +57,8 @@ class BuildTestTest extends BuildTestBase {
|
||||||
* @covers ::copyCodebase
|
* @covers ::copyCodebase
|
||||||
*/
|
*/
|
||||||
public function testCopyCodebaseExclude() {
|
public function testCopyCodebaseExclude() {
|
||||||
// Create a virtual file system containing only items that should be
|
// Create a virtual file system containing items that should be
|
||||||
// excluded.
|
// excluded. Exception being modules directory.
|
||||||
vfsStream::setup('drupal', NULL, [
|
vfsStream::setup('drupal', NULL, [
|
||||||
'sites' => [
|
'sites' => [
|
||||||
'default' => [
|
'default' => [
|
||||||
|
@ -65,6 +66,7 @@ class BuildTestTest extends BuildTestBase {
|
||||||
'a_file.txt' => 'some file.',
|
'a_file.txt' => 'some file.',
|
||||||
],
|
],
|
||||||
'settings.php' => '<?php $settings = stuff;',
|
'settings.php' => '<?php $settings = stuff;',
|
||||||
|
'settings.local.php' => '<?php $settings = override;',
|
||||||
],
|
],
|
||||||
'simpletest' => [
|
'simpletest' => [
|
||||||
'simpletest_hash' => [
|
'simpletest_hash' => [
|
||||||
|
@ -79,6 +81,15 @@ class BuildTestTest extends BuildTestBase {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'modules' => [
|
||||||
|
'my_module' => [
|
||||||
|
'vendor' => [
|
||||||
|
'my_vendor' => [
|
||||||
|
'composer.json' => "{\n}",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Mock BuildTestBase so that it thinks our VFS is the Drupal root.
|
// Mock BuildTestBase so that it thinks our VFS is the Drupal root.
|
||||||
|
@ -98,6 +109,13 @@ class BuildTestTest extends BuildTestBase {
|
||||||
$full_path = $base->getWorkspaceDirectory() . '/' . $test_directory;
|
$full_path = $base->getWorkspaceDirectory() . '/' . $test_directory;
|
||||||
|
|
||||||
$this->assertDirectoryExists($full_path);
|
$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
|
// Use scandir() to determine if our target directory is empty. It should
|
||||||
// only contain the system dot directories.
|
// only contain the system dot directories.
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
|
|
Loading…
Reference in New Issue