abstract class Drush_UnitTestCase

  1. 6.x tests/drush_testcase.inc Drush_UnitTestCase
  2. 5.x tests/drush_testcase.inc Drush_UnitTestCase

Base class for Drush unit tests

Those tests will run in a bootstrapped Drush environment

This should be ran in separate processes, which the following annotation should do in 3.6 and above:

@runTestsInSeparateProcesses

Hierarchy

Expanded class hierarchy of Drush_UnitTestCase

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
Drush_TestCase::bit_bucket function Borrowed from Drush. Checks operating system and returns supported bit bucket folder.
Drush_TestCase::convert_path function Converts a Windows path (dir1\dir2\dir3) into a Unix path (dir1/dir2/dir3). Also converts a cygwin "drive emulation" path (/cygdrive/c/dir1) into a proper drive path, still with Unix slashes (c:/dir1).
Drush_TestCase::db_url function
Drush_TestCase::directory_cache function
Drush_TestCase::escapeshellarg public static function
Drush_TestCase::fetchInstallDrupal function
Drush_TestCase::getOutput function Accessor for the last output.
Drush_TestCase::getOutputAsList function Accessor for the last output.
Drush_TestCase::get_tar_executable public static function
Drush_TestCase::is_windows public static function
Drush_TestCase::log function Print a log message to the console.
Drush_TestCase::log_level function
Drush_TestCase::randomString public function Helper function to generate a random string of arbitrary length.
Drush_TestCase::setUpDrupal function
Drush_TestCase::setUpFreshSandBox public static function Remove any pre-existing sandbox, then create a new one.
Drush_TestCase::webroot function
Drush_TestCase::_escapeshellarg_windows public static function
Drush_TestCase::__construct function
Drush_UnitTestCase::drush_major_version function
Drush_UnitTestCase::setUpBeforeClass public static function Minimally bootstrap drush Overrides Drush_TestCase::setUpBeforeClass
Drush_UnitTestCase::tearDownAfterClass public static function Runs after all tests in a class are run. Remove sandbox directory. Overrides Drush_TestCase::tearDownAfterClass

File

tests/drush_testcase.inc, line 435

View source
abstract class Drush_UnitTestCase extends Drush_TestCase {

  /**
   * Minimally bootstrap drush
   *
   * This is equivalent to the level DRUSH_BOOTSTRAP_NONE, as we
   * haven't run drush_bootstrap() yet. To do anything, you'll need to
   * bootstrap to some level using drush_bootstrap().
   *
   * @see drush_bootstrap()
   */
  public static function setUpBeforeClass() {
    parent::setUpBeforeClass();
    require_once (dirname(__FILE__) . '/../includes/bootstrap.inc');
    drush_bootstrap_prepare();
  }

  public static function tearDownAfterClass() {
    parent::tearDownAfterClass();
    drush_bootstrap_finish();
  }

  function drush_major_version() {
    return DRUSH_MAJOR_VERSION;
  }
}