5 use Symfony\Component\Filesystem\Filesystem;
6 use Webmozart\PathUtil\Path;
9 * Helper for installing testing modules.
11 trait TestModuleHelperTrait
14 * Copies the testing modules from a specific path into Drupal.
16 * @param array $modules A list of testing modules.
17 * @param string $sourcePath The path under which the modules are placed.
19 public function setupModulesForTests(array $modules, $sourcePath)
21 $webRoot = $this->webroot();
22 $fileSystem = new Filesystem();
23 foreach ($modules as $module) {
24 $sourceDir = Path::join($sourcePath, $module);
25 $this->assertFileExists($sourceDir);
26 $targetDir = Path::join($webRoot, "modules/unish/$module");
27 $fileSystem->mkdir($targetDir);
28 $this->recursiveCopy($sourceDir, $targetDir);