6 * Test to see if the `drush init` command does the
7 * setup that it is supposed to do.
11 class InitCommandCase extends CommandUnishTestCase
14 public function testInitCommand()
16 // Call `drush core-init`
17 $this->drush('core-init', [], ['add-path' => true, 'yes' => null, 'no-ansi' => null]);
18 $logOutput = $this->getErrorOutput();
19 // First test to ensure that the command claimed to have made the expected progress
20 $this->assertContains("Copied Drush bash customizations", $logOutput);
21 $this->assertContains("Updated bash configuration file", $logOutput);
23 // Next we test to see if there is evidence that those operations worked.
24 $home = getenv("HOME");
25 $this->assertFileExists("$home/.drush/drush.yml");
26 $this->assertFileExists("$home/.drush/drush.bashrc");
27 $this->assertFileExists("$home/.bashrc");
29 // Check to see if the .bashrc file sources our drush.bashrc file,
30 // and whether it adds the path to self::getDrush() to the $PATH
31 $bashrc_contents = file_get_contents("$home/.bashrc");
32 $this->assertContains('drush.bashrc', $bashrc_contents);
34 $this->assertContains(realpath(dirname(self::getDrush())), $bashrc_contents);