function shellAliasesCase::setUp

8.0.x shellAliasTest.php shellAliasesCase::setUp()
7.x shellAliasTest.php shellAliasesCase::setUp()
master shellAliasTest.php shellAliasesCase::setUp()

Write a config file that contains the shell-aliases array.

File

tests/shellAliasTest.php, line 15

Namespace

Unish

Class

shellAliasesCase
Tests for Shell aliases.

Code

function setUp() {
  parent::setUp();
  $contents = "
      <?php

      \$options['shell-aliases'] = array(
        'glopts' => 'topic core-global-options',
        'pull' => '!git pull',
        'echosimple' => '!echo {{@target}}',
        'echotest' => '!echo {{@target}} {{%root}} {{%mypath}}',
        'compound-command' => '!cd {{%sandbox}} && echo second',
      );
    ";
  file_put_contents(UNISH_SANDBOX . '/drushrc.php', trim($contents));
  if (!file_exists(UNISH_SANDBOX . '/b')) {
    mkdir(UNISH_SANDBOX . '/b');
  }
  $contents = "
      <?php

      \$options['shell-aliases'] = array(
        'also' => '!echo alternate config file included too',
      );
    ";
  file_put_contents(UNISH_SANDBOX . '/b/drushrc.php', trim($contents));
  $aliases['myalias'] = array(
    'root' => '/path/to/drupal',
    'uri' => 'mysite.org',
    '#peer' => '@live',
    'path-aliases' => array(
      '%mypath' => '/srv/data/mypath',
      '%sandbox' => UNISH_SANDBOX,
    ),
  );
  $contents = $this->unish_file_aliases($aliases);
  file_put_contents(UNISH_SANDBOX . '/aliases.drushrc.php', $contents);
}