class backendUnitCase

  1. 8.0.x tests/backendUnitTest.php backendUnitCase
  2. 6.x tests/backendTest.php backendUnitCase
  3. 7.x tests/backendUnitTest.php backendUnitCase
  4. 5.x tests/backendTest.php backendUnitCase
  5. master tests/backendUnitTest.php backendUnitCase


Expanded class hierarchy of backendUnitCase


Contains filters are case sensitive
Name Modifiers Typesort descending Description
backendUnitCase::testBackendFork function Covers the following target responsibilities.
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
Drush_UnitTestCase::drush_major_version function
Drush_TestCase::__construct function
Drush_TestCase::setUpFreshSandBox public static function Remove any pre-existing sandbox, then create a new one.
Drush_TestCase::log function Print a log message to the console.
Drush_TestCase::log_level function
Drush_TestCase::is_windows public static function
Drush_TestCase::get_tar_executable public static function
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::bit_bucket function Borrowed from Drush. Checks operating system and returns supported bit bucket folder.
Drush_TestCase::escapeshellarg public static function
Drush_TestCase::_escapeshellarg_windows public static function
Drush_TestCase::randomString public function Helper function to generate a random string of arbitrary length.
Drush_TestCase::getOutput function Accessor for the last output.
Drush_TestCase::getOutputAsList function Accessor for the last output.
Drush_TestCase::webroot function
Drush_TestCase::directory_cache function
Drush_TestCase::db_url function
Drush_TestCase::setUpDrupal function
Drush_TestCase::fetchInstallDrupal function
Drush_TestCase::drupalSitewideDirectory function
Drush_TestCase::getOutputFromJSON function Accessor for the last output, decoded from json.
Drush_TestCase::db_driver function


tests/backendTest.php, line 260
We choose to test the backend system in two parts. - Origin. These tests assure that we are generate a proper ssh command when a backend invoke is needed. - Target. These tests assure that drush generates a delimited JSON array …

View source
class backendUnitCase extends Drush_UnitTestCase {

   * Covers the following target responsibilities.
   *   - Insures that drush_invoke_process() called with fork backend set is able
   *     to invoke a non-blocking process.
  function testBackendFork() {
    // Ensure that file that will be created by forked process does not exist
    // before invocation.
    $test_file = UNISH_SANDBOX . '/fork_test.txt';
    if (file_exists($test_file)) {

    // Sleep for a millisecond, then create the file
    $ev_php = "usleep(1000);fopen('$test_file','a');";
    drush_invoke_process("@none", "ev", array($ev_php), array(), array("fork" => TRUE));

    // Test file does not exist immediate after process forked
    $this->assertEquals(file_exists($test_file), FALSE);
    // Check every 100th of a second for up to 4 seconds to see if the file appeared
    $repetitions = 400;
    while (!file_exists($test_file) && ($repetitions > 0)) {
    // Assert that the file did finally appear
    $this->assertEquals(file_exists($test_file), TRUE);