More updates to stop using dev or alpha or beta versions.
[yaffs-website] / vendor / drush / drush / tests / TestModuleHelperTrait.php
1 <?php
2
3 namespace Unish;
4
5 use Symfony\Component\Filesystem\Filesystem;
6 use Webmozart\PathUtil\Path;
7
8 /**
9  * Helper for installing testing modules.
10  */
11 trait TestModuleHelperTrait
12 {
13     /**
14      * Copies the testing modules from a specific path into Drupal.
15      *
16      * @param array $modules A list of testing modules.
17      * @param string $sourcePath The path under which the modules are placed.
18      */
19     public function setupModulesForTests(array $modules, $sourcePath)
20     {
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);
29         }
30     }
31 }