class commandSpecificCase

  1. 8.0.x tests/commandSpecificTest.php commandSpecificCase
  2. 6.x tests/commandSpecificTest.php commandSpecificCase
  3. 7.x tests/commandSpecificTest.php commandSpecificCase
  4. 5.x tests/commandSpecificTest.php commandSpecificCase
  5. master tests/commandSpecificTest.php commandSpecificCase
  • Assure that context API behaves as designed. Mostly implicitly tested, but we
  • do have some edges that need explicit testing.

*

  • *
  • @group base

Namespace

Unish

See also

drush/includes/context.inc.

Hierarchy

Expanded class hierarchy of commandSpecificCase

Members

Contains filters are case sensitive
Name Modifiers Typesort descending Description
CommandUnishTestCase::EXIT_SUCCESS constant
CommandUnishTestCase::EXIT_ERROR constant
CommandUnishTestCase::UNISH_EXITCODE_USER_ABORT constant
commandSpecificCase::setUp function Try to write a tiny drushrc.php to each place that drush checks. Also write a sites/dev/aliases.drushrc.php file to the sandbox.
commandSpecificCase::testCommandSpecific function
CommandUnishTestCase::getOutput function Accessor for the last output, trimmed.
CommandUnishTestCase::getOutputRaw function Accessor for the last output, non-trimmed.
CommandUnishTestCase::getOutputAsList function Accessor for the last output, rtrimmed and split on newlines.
CommandUnishTestCase::getErrorOutput function Accessor for the last stderr output, trimmed.
CommandUnishTestCase::getErrorOutputRaw function Accessor for the last stderr output, non-trimmed.
CommandUnishTestCase::getErrorOutputAsList function Accessor for the last stderr output, rtrimmed and split on newlines.
CommandUnishTestCase::getOutputFromJSON function Accessor for the last output, decoded from json.
CommandUnishTestCase::execute function Actually runs the command.
CommandUnishTestCase::drush function Invoke drush in via execute().
CommandUnishTestCase::run public function Override the run method, so we can add in our code coverage data after the test has run.
CommandUnishTestCase::parse_backend_output function A slightly less functional copy of drush_backend_parse_output().
CommandUnishTestCase::assertLogHasMessage function Ensure that an expected log message appears in the Drush log.
CommandUnishTestCase::drush_major_version function
UnishTestCase::__construct function
UnishTestCase::setUpBeforeClass public static function Assure that each class starts with an empty sandbox directory and a clean environment - http://drupal.org/node/1103568.
UnishTestCase::setUpFreshSandBox public static function Remove any pre-existing sandbox, then create a new one.
UnishTestCase::tearDownAfterClass public static function Runs after all tests in a class are run. Remove sandbox directory.
UnishTestCase::log function Print a log message to the console.
UnishTestCase::log_level function
UnishTestCase::is_windows public static function
UnishTestCase::get_tar_executable public static function
UnishTestCase::tick function Print out a tick mark.
UnishTestCase::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).
UnishTestCase::bit_bucket function Borrowed from Drush. Checks operating system and returns supported bit bucket folder.
UnishTestCase::escapeshellarg public static function
UnishTestCase::_escapeshellarg_windows public static function
UnishTestCase::randomString public function Helper function to generate a random string of arbitrary length.
UnishTestCase::mkdir public function
UnishTestCase::recursive_copy public function
UnishTestCase::webroot function
UnishTestCase::getSites function
UnishTestCase::directory_cache function
UnishTestCase::db_url function
UnishTestCase::db_driver function
UnishTestCase::setUpDrupal function
UnishTestCase::fetchInstallDrupal function
UnishTestCase::writeSiteAlias function
UnishTestCase::unish_file_aliases function Prepare the contents of an aliases file.
UnishTestCase::drupalSitewideDirectory function
CommandUnishTestCase::$coverage_data protected property Code coverage data collected during a single test.
CommandUnishTestCase::$process private property Process of last executed command.
CommandUnishTestCase::$defaultTimeout private property Default timeout for commands.
CommandUnishTestCase::$timeout protected property Timeout for command.
CommandUnishTestCase::$defaultIdleTimeout private property Default idle timeout for commands.
CommandUnishTestCase::$idleTimeout protected property Idle timeouts for commands.
UnishTestCase::$sites private static property A list of Drupal sites that have been recently installed. They key is the site name and values are details about each site.

File

tests/commandSpecificTest.php, line 13

View source
class commandSpecificCase extends CommandUnishTestCase {

  /**
   * Try to write a tiny drushrc.php to each place that drush checks. Also
   * write a sites/dev/aliases.drushrc.php file to the sandbox.
   */
  function setUp() {
    parent::setUp();

    $path = UNISH_SANDBOX . '/aliases.drushrc.php';
    $aliases['site1'] = array(
      'root' => UNISH_SANDBOX,
      'uri' => 'site1.com',
      'source-command-specific' => array(
        'core-rsync' => array(
          'exclude-paths' => 'excluded_by_source',
        ),
      ),
      'target-command-specific' => array(
        'core-rsync' => array(
          'exclude-paths' => 'excluded_by_target',
        ),
      ),
      'path-aliases' => array(
        '%files' => 'sites/default/files',
      ),
    );
    $contents = $this->unish_file_aliases($aliases);
    $return = file_put_contents($path, $contents);
  }

  function testCommandSpecific() {
    $options = array(
      'alias-path' => UNISH_SANDBOX,
      'simulate' => NULL,
      'include-vcs' => NULL,
    );
    $this->drush('core-rsync', array('/tmp', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
    $output = trim($this->getOutput());
    $this->assertContains('excluded_by_target', $output);
    $this->drush('core-rsync', array('@site1', '/tmp'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
    $output = trim($this->getOutput());
    $this->assertContains('excluded_by_source', $output);
    $this->drush('core-rsync', array('@site1', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
    $output = trim($this->getOutput());
    $this->assertContains('excluded_by_target', $output);
    // Now do that all again with 'exclude-files'
    $options['exclude-files'] = NULL;
    $this->drush('core-rsync', array('/tmp', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
    $output = trim($this->getOutput());
    $this->assertContains('sites/default/files', $output);
    $this->assertContains('excluded_by_target', $output);
    $this->assertNotContains('include-vcs', $output);
    $this->assertNotContains('exclude-paths', $output);
    $this->assertNotContains('exclude-files-processed', $output);
    $this->drush('core-rsync', array('@site1', '/tmp'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
    $output = trim($this->getOutput());
    $this->assertContains('sites/default/files', $output);
    // This one does not work. @see drush_sitealias_evaluate_path
    //    $this->assertContains('excluded_by_source', $output);
    $this->assertNotContains('include-vcs', $output);
    $this->assertNotContains('exclude-paths', $output);
    $this->assertNotContains('exclude-files-processed', $output);
    $this->drush('core-rsync', array('@site1', '@site1'), $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1');
    $output = trim($this->getOutput());
    $this->assertContains('sites/default/files', $output);
    $this->assertContains('excluded_by_target', $output);
    $this->assertNotContains('include-vcs', $output);
    $this->assertNotContains('exclude-paths', $output);
    $this->assertNotContains('exclude-files-processed', $output);
  }
}