public function coreCase::testStandaloneScript

8.0.x coreTest.php public coreCase::testStandaloneScript()
6.x coreTest.php public coreCase::testStandaloneScript()
7.x coreTest.php public coreCase::testStandaloneScript()
4.x coreTest.php public coreCase::testStandaloneScript()
5.x coreTest.php public coreCase::testStandaloneScript()
master coreTest.php public coreCase::testStandaloneScript()

Test standalone php-script scripts. Assure that script args and options work.

File

tests/coreTest.php, line 67

Namespace

Unish

Class

coreCase
Tests for core commands.

Code

public function testStandaloneScript() {
  if ($this->is_windows()) {
    $this->markTestSkipped('Standalone scripts not currently available on Windows.');
  }

  $this->drush('version', array('drush_version'), array('pipe' => NULL));
  $standard = $this->getOutput();

  // Write out a hellounish.script into the sandbox. The correct /path/to/drush
  // is in the shebang line.
  $filename = 'hellounish.script';
  $data = '#!/usr/bin/env [PATH-TO-DRUSH]

$arg = drush_shift();
drush_invoke("version", $arg);
';
  $data = str_replace('[PATH-TO-DRUSH]', UNISH_DRUSH, $data);
  $script = UNISH_SANDBOX . '/' . $filename;
  file_put_contents($script, $data);
  chmod($script, 0755);
  $this->execute("$script drush_version --pipe");
  $standalone = $this->getOutput();
  $this->assertEquals($standard, $standalone);
}