7 * Tests for ssh.drush.inc
11 class siteSshCase extends CommandUnishTestCase {
14 * Test drush ssh --simulate. No additional bash passed.
16 public function testInteractive() {
17 if ($this->is_windows()) {
18 $this->markTestSkipped('ssh command not currently available on Windows.');
24 $this->drush('ssh', array(), $options, 'user@server/path/to/drupal#sitename', NULL, self::EXIT_SUCCESS, '2>&1');
25 $output = $this->getOutput();
26 $expected = sprintf('Calling proc_open(ssh -o PasswordAuthentication=no -t %s@%s %s);', self::escapeshellarg('user'), self::escapeshellarg('server'), "'cd /path/to/drupal && bash -l'");
27 $this->assertEquals($expected, $output);
31 * Test drush ssh --simulate 'date'.
32 * @todo Run over a site list. drush_sitealias_get_record() currently cannot
33 * handle a site list comprised of longhand site specifications.
35 public function testNonInteractive() {
40 $this->drush('ssh', array('date'), $options, 'user@server/path/to/drupal#sitename', NULL, self::EXIT_SUCCESS, '2>&1');
41 $output = $this->getOutput();
42 $expected = sprintf('Calling proc_open(ssh -o PasswordAuthentication=no %s@%s %s);', self::escapeshellarg('user'), self::escapeshellarg('server'), self::escapeshellarg('date'));
43 $this->assertEquals($expected, $output);
47 * Test drush ssh with multiple arguments (preferred form).
49 public function testSshMultipleArgs() {
54 $this->drush('ssh', array('ls', '/path1', '/path2'), $options, 'user@server/path/to/drupal#sitename', NULL, self::EXIT_SUCCESS, '2>&1');
55 $output = $this->getOutput();
56 $expected = sprintf('Calling proc_open(ssh -o PasswordAuthentication=no %s@%s %s);', self::escapeshellarg('user'), self::escapeshellarg('server'), self::escapeshellarg('ls /path1 /path2'));
57 $this->assertEquals($expected, $output);
61 * Test drush ssh with multiple arguments (legacy form).
63 public function testSshMultipleArgsLegacy() {
68 $this->drush('ssh', array('ls /path1 /path2'), $options, 'user@server/path/to/drupal#sitename', NULL, self::EXIT_SUCCESS, '2>&1');
69 $output = $this->getOutput();
70 $expected = sprintf('Calling proc_open(ssh -o PasswordAuthentication=no %s@%s %s);', self::escapeshellarg('user'), self::escapeshellarg('server'), self::escapeshellarg('ls /path1 /path2'));
71 $this->assertEquals($expected, $output);