releaseInfoTest.php

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

Tests for release_info engine.

Namespace

Unish

Classes

Namesort descending Description
releaseInfoCase pm testing

File

tests/releaseInfoTest.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Tests for release_info engine.
  5. */
  6. namespace Unish;
  7. /**
  8. * pm testing
  9. *
  10. * @group pm
  11. */
  12. class releaseInfoCase extends UnitUnishTestCase {
  13. /**
  14. * Pick right release from the XML (dev, latest published+recommended, ...).
  15. */
  16. public function testReleaseXML() {
  17. _drush_add_commandfiles(array(DRUSH_BASE_PATH . '/commands/pm'));
  18. $release_info = drush_include_engine('release_info', 'updatexml');
  19. // Use a local, static XML file because live files change over time.
  20. $xml = simplexml_load_file(dirname(__FILE__). '/devel.xml');
  21. $project_release_info = new \Drush\UpdateService\Project($xml);
  22. // Pick specific release.
  23. $release = $project_release_info->getSpecificRelease('6.x-1.18');
  24. $this->assertEquals('6.x-1.18', $release['version']);
  25. // Pick latest recommended+published with no further specification.
  26. // 6.x-2.2 is skipped because it is unpublished.
  27. // 6.x-2.2-rc1 is skipped because it is not a stable release.
  28. $release = $project_release_info->getRecommendedOrSupportedRelease();
  29. $this->assertEquals('6.x-2.1', $release['version']);
  30. // Pick latest from a specific branch.
  31. $release = $project_release_info->getSpecificRelease('6.x-1');
  32. $this->assertEquals('6.x-1.23', $release['version']);
  33. // Pick latest from a different branch.
  34. // 6.x-2.2 is skipped because it is unpublished.
  35. // 6.x-2.2-rc1 is skipped because it is not a stable release.
  36. $release = $project_release_info->getSpecificRelease('6.x-2');
  37. $this->assertEquals('6.x-2.1', $release['version']);
  38. // Pick a -dev release.
  39. $release = $project_release_info->getSpecificRelease('6.x-1.x');
  40. $this->assertEquals('6.x-1.x-dev', $release['version']);
  41. // Test UpdateServiceProject::getSpecificRelease().
  42. // Test we get latest release in branch 1.
  43. $release = $project_release_info->getSpecificRelease('6.x-1');
  44. $this->assertEquals('6.x-1.23', $release['version']);
  45. // Test UpdateServiceProject::getDevRelease().
  46. $release = $project_release_info->getDevRelease();
  47. $this->assertEquals('6.x-1.x-dev', $release['version']);
  48. }
  49. }