Yaffs site version 1.1
[yaffs-website] / vendor / drush / drush / tests / initCommandTest.php
1 <?php
2
3 namespace Unish;
4
5 /**
6  *  Test to see if the `drush init` command does the
7  *  setup that it is supposed to do.
8  *
9  *  @group base
10  */
11 class initCommandCase extends CommandUnishTestCase {
12
13   function testInitCommand() {
14     // Call `drush core-init`
15     $this->drush('core-init', array(), array('backend' => NULL, 'add-path' => TRUE, 'yes' => NULL));
16     $parsed = $this->parse_backend_output($this->getOutput());
17     // First test to ensure that the command claimed to have made the expected progress
18     $this->assertLogHasMessage($parsed['log'], "Copied example Drush configuration file", 'ok');
19     $this->assertLogHasMessage($parsed['log'], "Copied example Drush bash configuration file", 'ok');
20     $this->assertLogHasMessage($parsed['log'], "Updated bash configuration file", 'ok');
21     // Next we will test to see if there is evidence that those
22     // operations worked.
23     $home = getenv("HOME");
24     $this->assertFileExists("$home/.drush/drushrc.php");
25     $this->assertFileExists("$home/.drush/drush.bashrc");
26     $this->assertFileExists("$home/.bashrc");
27
28     // Check to see if the .bashrc file sources our drush.bashrc file,
29     // and whether it adds the path to UNISH_DRUSH to the $PATH
30     $bashrc_contents = file_get_contents("$home/.bashrc");
31     $this->assertContains('drush.bashrc', $bashrc_contents);
32     $this->assertContains(dirname(UNISH_DRUSH), $bashrc_contents);
33   }
34 }