Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / isolation / src / FixtureFactory.php
diff --git a/vendor/drush/drush/isolation/src/FixtureFactory.php b/vendor/drush/drush/isolation/src/FixtureFactory.php
new file mode 100644 (file)
index 0000000..a1b2f58
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace Drush;
+
+use \Drush\Config\Environment;
+
+trait FixtureFactory
+{
+    protected function fixturesDir()
+    {
+        return dirname(__DIR__) . '/fixtures';
+    }
+
+    protected function homeDir()
+    {
+        return $this->fixturesDir() . '/home';
+    }
+
+    // It is still an aspirational goal to add Drupal 7 support back to Drush. :P
+    // For now, only Drupal 8 is supported.
+    protected function siteDir($majorVersion = '8')
+    {
+        return $this->fixturesDir() . '/sites/d' . $majorVersion;
+    }
+
+    protected function environment($cwd = false)
+    {
+        $fixturesDir = $this->fixturesDir();
+        $home = $this->homeDir();
+        if (!$cwd) {
+            $cwd = $home;
+        }
+        $autoloadFile = dirname(__DIR__) . '/vendor/autoload.php';
+
+        $environment = new Environment($home, $cwd, $autoloadFile);
+        $environment
+            ->setEtcPrefix($fixturesDir)
+            ->setSharePrefix($fixturesDir . '/usr');
+
+        return $environment;
+    }
+}