-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
InitCommandTest.php
38 lines (31 loc) · 1.5 KB
/
InitCommandTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Unish;
use Webmozart\PathUtil\Path;
/**
* Test to see if the `drush init` command does the
* setup that it is supposed to do.
*
* @group base
*/
class InitCommandCase extends CommandUnishTestCase
{
public function testInitCommand()
{
// Call `drush core-init`
$this->drush('core-init', [], ['add-path' => true, 'yes' => null, 'no-ansi' => null]);
$logOutput = $this->getErrorOutput();
// First test to ensure that the command claimed to have made the expected progress
$this->assertStringContainsString("Copied Drush bash customizations", $logOutput);
$this->assertStringContainsString("Updated bash configuration file", $logOutput);
// Next we test to see if there is evidence that those operations worked.
$home = Path::join($this->getSandbox(), 'home');
$this->assertFileExists("$home/.drush/drush.yml", $this->buildProcessMessage());
$this->assertFileExists("$home/.drush/drush.bashrc", $this->buildProcessMessage());
$this->assertFileExists("$home/.bashrc", $this->buildProcessMessage());
// Check to see if the .bashrc file sources our drush.bashrc file,
// and whether it adds the path to self::getDrush() to the $PATH
$bashrc_contents = file_get_contents("$home/.bashrc");
$this->assertStringContainsString('drush.bashrc', $bashrc_contents);
$this->assertStringContainsString(Path::canonicalize(realpath(dirname(self::getDrush()))), $bashrc_contents);
}
}