function Drush_CommandTestCase::execute

6.x Drush_CommandTestCase::execute($command, $expected_return = self::EXIT_SUCCESS, $env = array())
5.x Drush_CommandTestCase::execute($command, $expected_return = self::EXIT_SUCCESS, $env = array())

Actually runs the command. Does not trap the error stream output as this need PHP 4.3+.


string $command: The actual command line to run.

integer $expected_return: The return code to expect

Return value

integer Exit code. Usually self::EXIT_ERROR or self::EXIT_SUCCESS.

10 calls to Drush_CommandTestCase::execute()
archiveDumpCase::testArchiveDump in tests/archiveDumpTest.php
Test if tarball generated by archive-dump looks right.
archiveDumpCase::unTar in tests/archiveDumpTest.php
Untar an archive and return the path to the untarred folder.
backendCase::testOrigin in tests/backendTest.php
backendCase::testRealtimeOutput in tests/backendTest.php
backendCase::testTarget in tests/backendTest.php

... See full list


tests/, line 319




function execute($command, $expected_return = self::EXIT_SUCCESS, $env = array()) {
  $this->_output = FALSE;
  $return = 1;
  $this->log("Executing: $command", 'notice');

  // Apply the environment variables we need for our test
  // to the head of the command
  $prefix = '';
  foreach ($env as $env_name => $env_value) {
    $prefix .= $env_name . '=' . self::escapeshellarg($env_value) . ' ';
  exec($prefix . $command, $this->_output, $return);

  $this->assertEquals($expected_return, $return, 'Unexpected exit code: ' . $command);
  return $return;