Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / tests / ConfigPullTest.php
diff --git a/vendor/drush/drush/tests/ConfigPullTest.php b/vendor/drush/drush/tests/ConfigPullTest.php
new file mode 100644 (file)
index 0000000..c068f18
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+namespace Unish;
+
+use Webmozart\PathUtil\Path;
+
+/**
+ * Tests for config-pull command. Sets up two Drupal sites.
+ * @group commands
+ * @group slow
+ * @group config
+ */
+class ConfigPullCase extends CommandUnishTestCase
+{
+
+    public function setUp()
+    {
+        $this->setUpDrupal(2, true);
+    }
+
+  /*
+   * Make sure a change propagates using config-pull+config-import.
+   */
+    public function testConfigPull()
+    {
+        $aliases = $this->getAliases();
+        $source = $aliases['stage'];
+        $destination = $aliases['dev'];
+        // Make UUID match.
+        $this->drush('config-get', ['system.site', 'uuid'], ['yes' => null], $source);
+        list($name, $uuid) = explode(' ', $this->getOutput());
+        $this->drush('config-set', ['system.site', 'uuid', $uuid], ['yes' => null], $destination);
+
+        $this->drush('config-set', ['system.site', 'name', 'testConfigPull'], ['yes' => null], $source);
+        $this->drush('config-pull', [$source, $destination]);
+        $this->drush('config-import', [], ['yes' => null], $destination);
+        $this->drush('config-get', ['system.site', 'name'], [], $source);
+        $this->assertEquals("'system.site:name': testConfigPull", $this->getOutput(), 'Config was successfully pulled.');
+
+        // Test that custom target dir works
+        $target = Path::join($this->getSandbox(), __CLASS__);
+        $this->mkdir($target);
+        $this->drush('config-pull', [$source, "$destination:$target"]);
+        $this->assertFileExists(Path::join($target, 'system.site.yml'));
+    }
+}