d060416e2456cb3fae7a92121da0bf7b07105f00
[yaffs-website] / vendor / drush / drush / tests / SiteAliasConvertTest.php
1 <?php
2
3 namespace Unish;
4
5 use Symfony\Component\Yaml\Yaml;
6 use Webmozart\PathUtil\Path;
7
8 /**
9  * @group base
10  */
11 class SiteAliasConvertTest extends CommandUnishTestCase
12 {
13
14   /**
15    * Test functionality of site:alias-convert.
16    */
17     public function testSiteAliasConvert()
18     {
19         // Use a custom destination so we don't have to install a Drupal.
20         $destination = Path::join(self::getSandbox(), 'testSiteAliasConvert');
21         $this->drush('site:alias-convert', ['destination' => $destination], ['sources' =>  Path::join(__DIR__, '/resources/alias-fixtures')]);
22
23         // Write config alias-path that specifies our destination.
24         $config['drush']['paths']['alias-path'][] = $destination;
25         file_put_contents(Path::join(self::getSandbox(), 'etc/drush/drush.yml'), Yaml::dump($config, 3));
26
27         $this->drush('site:alias', [], ['format' => 'json']);
28         $json = $this->getOutputFromJSON();
29         $this->assertObjectHasAttribute('@drupalvm.dev', $json);
30         $this->assertObjectHasAttribute('@www-drupalvm.dev', $json);
31         $dev = $json->{'@drupalvm.dev'};
32         $this->assertSame('drupalvm.dev', $dev->host);
33         $this->assertSame('-o PasswordAuthentication=no -i /.vagrant.d/insecure_private_key', $dev->ssh->{'options'});
34         $this->assertSame('/var/www/drupalvm/drupal/vendor/drush/drush/drush', $dev->paths->{'drush-script'});
35     }
36 }