a1b2f5819f9b5e22a8a08c4cbc9859e661cfc97f
[yaffs-website] / vendor / drush / drush / isolation / src / FixtureFactory.php
1 <?php
2 namespace Drush;
3
4 use \Drush\Config\Environment;
5
6 trait FixtureFactory
7 {
8     protected function fixturesDir()
9     {
10         return dirname(__DIR__) . '/fixtures';
11     }
12
13     protected function homeDir()
14     {
15         return $this->fixturesDir() . '/home';
16     }
17
18     // It is still an aspirational goal to add Drupal 7 support back to Drush. :P
19     // For now, only Drupal 8 is supported.
20     protected function siteDir($majorVersion = '8')
21     {
22         return $this->fixturesDir() . '/sites/d' . $majorVersion;
23     }
24
25     protected function environment($cwd = false)
26     {
27         $fixturesDir = $this->fixturesDir();
28         $home = $this->homeDir();
29         if (!$cwd) {
30             $cwd = $home;
31         }
32         $autoloadFile = dirname(__DIR__) . '/vendor/autoload.php';
33
34         $environment = new Environment($home, $cwd, $autoloadFile);
35         $environment
36             ->setEtcPrefix($fixturesDir)
37             ->setSharePrefix($fixturesDir . '/usr');
38
39         return $environment;
40     }
41 }