function Drush_TestCase::execute

4.x drush_testcase.inc Drush_TestCase::execute($command, $expected_return = self::EXIT_SUCCESS)

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

Parameters

string $command: The actual command line to run.

Return value

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

File

tests/drush_testcase.inc, line 91

Class

Drush_TestCase

Code

function execute($command, $expected_return = self::EXIT_SUCCESS) {
  $this->_output = FALSE;
  // todo check verbose level from phpunit.
  if (TRUE) {
    print "\nExecuting: $command \n";
  }
  exec($command, $this->_output, $return);
  $this->assertEquals($expected_return, $return, 'Unexpected exit code: ' . $command);
  return $return;
}