function backendCase::testOrigin

8.0.x backendTest.php backendCase::testOrigin()
6.x backendTest.php backendCase::testOrigin()
7.x backendTest.php backendCase::testOrigin()
4.x backendTest.php backendCase::testOrigin()
5.x backendTest.php backendCase::testOrigin()
master backendTest.php backendCase::testOrigin()

Covers the following origin responsibilities.

  • A remote host is recognized in site specification.
  • Generates expected ssh command.

General handling of site aliases will be in sitealiasTest.php.

File

tests/backendTest.php, line 58

Namespace

Unish

Class

backendCase
We choose to test the backend system in two parts.

Code

function testOrigin() {
  $exec = sprintf('%s %s version arg1 arg2 --simulate --ssh-options=%s 2>/dev/null | grep ssh', UNISH_DRUSH, self::escapeshellarg('user@server/path/to/drupal#sitename'), self::escapeshellarg('-i mysite_dsa'));
  $this->execute($exec);
  $bash = $this->escapeshellarg('drush  --uri=sitename --root=/path/to/drupal  version arg1 arg2 2>&1');
  $expected = "Simulating backend invoke: ssh -i mysite_dsa user@server $bash 2>&1";
  $output = $this->getOutput();
  $this->assertEquals($expected, $output, 'Expected ssh command was built');
}