c068f18da627dcf61c14904533a425142d210a93
[yaffs-website] / vendor / drush / drush / tests / ConfigPullTest.php
1 <?php
2 namespace Unish;
3
4 use Webmozart\PathUtil\Path;
5
6 /**
7  * Tests for config-pull command. Sets up two Drupal sites.
8  * @group commands
9  * @group slow
10  * @group config
11  */
12 class ConfigPullCase extends CommandUnishTestCase
13 {
14
15     public function setUp()
16     {
17         $this->setUpDrupal(2, true);
18     }
19
20   /*
21    * Make sure a change propagates using config-pull+config-import.
22    */
23     public function testConfigPull()
24     {
25         $aliases = $this->getAliases();
26         $source = $aliases['stage'];
27         $destination = $aliases['dev'];
28         // Make UUID match.
29         $this->drush('config-get', ['system.site', 'uuid'], ['yes' => null], $source);
30         list($name, $uuid) = explode(' ', $this->getOutput());
31         $this->drush('config-set', ['system.site', 'uuid', $uuid], ['yes' => null], $destination);
32
33         $this->drush('config-set', ['system.site', 'name', 'testConfigPull'], ['yes' => null], $source);
34         $this->drush('config-pull', [$source, $destination]);
35         $this->drush('config-import', [], ['yes' => null], $destination);
36         $this->drush('config-get', ['system.site', 'name'], [], $source);
37         $this->assertEquals("'system.site:name': testConfigPull", $this->getOutput(), 'Config was successfully pulled.');
38
39         // Test that custom target dir works
40         $target = Path::join($this->getSandbox(), __CLASS__);
41         $this->mkdir($target);
42         $this->drush('config-pull', [$source, "$destination:$target"]);
43         $this->assertFileExists(Path::join($target, 'system.site.yml'));
44     }
45 }