function backendCase::testDispatchUsingAlias

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

File

tests/backendTest.php, line 21

Namespace

Unish

Class

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

Code

function testDispatchUsingAlias() {
  $this->markTestIncomplete('Started failing due to https://github.com/drush-ops/drush/pull/555');

  $aliasPath = UNISH_SANDBOX . '/aliases';
  mkdir($aliasPath);
  $aliasFile = $aliasPath . '/foo.aliases.drushrc.php';
  $aliasContents = <<<EOD
  <?php
  // Written by Unish. This file is safe to delete.
  \$aliases['dev'] = array('root' => '/fake/path/to/root', 'uri' => 'default');
EOD;
  file_put_contents($aliasFile, $aliasContents);
  $options = array(
    'alias-path' => $aliasPath,
    'include' => dirname(__FILE__), // Find unit.drush.inc commandfile.
    'script-path' => dirname(__FILE__) . '/resources', // Find unit.drush.inc commandfile.
    'backend' => TRUE,
  );
  $this->drush('php-script', array('testDispatchUsingAlias_script'), $options);
  $parsed = $this->parse_backend_output($this->getOutput());

  // $parsed['with'] and $parsed['without'] now contain an array
  // each with the original arguments passed in with and without
  // 'dispatch-using-alias', respectively.
  $argDifference = array_diff($parsed['object']['with'], $parsed['object']['without']);
  $this->assertEquals(array_diff(array_values($argDifference), array('@foo.dev')), array());
  $argDifference = array_diff($parsed['object']['without'], $parsed['object']['with']);
  $this->assertEquals(array_diff(array_values($argDifference), array('--root=/fake/path/to/root', '--uri=default')), array());
}