class releaseInfoCase

  1. 8.0.x tests/releaseInfoTest.php releaseInfoCase
  2. 6.x tests/releaseInfoTest.php releaseInfoCase
  3. 7.x tests/releaseInfoTest.php releaseInfoCase
  4. 5.x tests/releaseInfoTest.php releaseInfoCase
  5. master tests/releaseInfoTest.php releaseInfoCase

pm testing

@group pm

Hierarchy

Expanded class hierarchy of releaseInfoCase

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
releaseInfoCase::testReleaseXML public function
releaseInfoCase::testVersionString public function

File

tests/releaseInfoTest.php, line 8

View source
class releaseInfoCase extends Drush_UnitTestCase {

  /*
   * Parse Drupal version and release from project specification.
   *
   * @see pm_parse_project_version().
   */
  public function testVersionString() {
    require_once DRUSH_BASE_PATH . '/commands/pm/pm.drush.inc';
    $request_data = pm_parse_project_version(array('devel-6.x-1.18'));
    $this->assertArrayHasKey('devel', $request_data);
    $this->assertEquals($request_data['devel']['drupal_version'], '6.x');
    $this->assertEquals($request_data['devel']['project_version'], '1.18');
  }

  /*
   * Pick right release from the XML (dev, latest published+recommended, ...).
   */
  public function testReleaseXML() {
    _drush_add_commandfiles(array(DRUSH_BASE_PATH . '/commands/pm'));
    drush_include_engine('release_info', 'updatexml');

    // Use a local, static XML file because live files change over time.
    $xml = simplexml_load_file(dirname(__FILE__) . '/devel.xml');

    // Pick specific release.
    $request_data = array(
      'name' => 'devel',
      'drupal_version' => '6.x',
      'project_version' => '1.18',
      'version' => '6.x-1.18',
    );
    $release = updatexml_parse_release($request_data, $xml);
    $this->assertEquals($release['version'], '6.x-1.18');

    // Pick latest recommended+published with no further specification.
    // 6.x-2.2 is skipped because it is unpublished.
    // 6.x-2.2-rc1 is skipped because it is not a stable release.
    $request_data = array(
      'name' => 'devel',
      'drupal_version' => '6.x',
    );
    $release = updatexml_parse_release($request_data, $xml);
    $this->assertEquals($release['version'], '6.x-2.1');

    // Pick latest from a specific branch.
    $request_data = array(
      'name' => 'devel',
      'drupal_version' => '6.x',
      'version' => '6.x-1',
    );
    $release = updatexml_parse_release($request_data, $xml);
    $this->assertEquals($release['version'], '6.x-1.23');

    // Pick latest from a different branch.
    $request_data = array(
      'name' => 'devel',
      'drupal_version' => '6.x',
      'version' => '6.x-2',
    );
    $release = updatexml_parse_release($request_data, $xml);
    // 6.x-2.2 is skipped because it is unpublished.
    // 6.x-2.2-rc1 is skipped because it is not a stable release.
    $this->assertEquals($release['version'], '6.x-2.1');

    // Pick a -dev release.
    $request_data = array(
      'name' => 'devel',
      'drupal_version' => '6.x',
      'version' => '6.x-1.x',
    );
    $release = updatexml_parse_release($request_data, $xml);
    $this->assertEquals($release['version'], '6.x-1.x-dev');

    // Test $restrict_to parameter.
    $request_data['version'] = '6.x-1';
    $release = updatexml_parse_release($request_data, $xml, 'version');
    $this->assertEquals($release['version'], '6.x-1.23');
    $release = updatexml_parse_release($request_data, $xml, 'dev');
    $this->assertEquals($release['version'], '6.x-1.x-dev');
  }
}