generateMakeTest.php

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

Classes

Namesort descending Description
generateMakeCase Generate makefile tests

File

tests/generateMakeTest.php
View source
  1. <?php
  2. /**
  3. * Generate makefile tests
  4. *
  5. * @group commands
  6. * @group make
  7. */
  8. class generateMakeCase extends Drush_CommandTestCase {
  9. function testGenerateMake() {
  10. $sites = $this->setUpDrupal(1, TRUE, UNISH_DRUPAL_MAJOR_VERSION, 'standard');
  11. $options = array(
  12. 'yes' => NULL,
  13. 'pipe' => NULL,
  14. 'root' => $this->webroot(),
  15. 'uri' => key($sites),
  16. 'cache' => NULL,
  17. 'invoke' => NULL, // Don't validate options
  18. );
  19. $this->drush('pm-download', array('omega', 'context', 'delta', 'adaptive_image', 'ctools'), $options);
  20. $this->drush('pm-enable', array('omega', 'context', 'delta', 'adaptive_image'), $options);
  21. $makefile = UNISH_SANDBOX . '/dev.make';
  22. // First generate a simple makefile with no version information
  23. $this->drush('generate-makefile', array($makefile), array('exclude-versions' => NULL) + $options);
  24. $expected = '; This file was auto-generated by drush make
  25. core = 7.x
  26. api = 2
  27. projects[] = "drupal"
  28. ; Modules
  29. projects[] = "adaptive_image"
  30. projects[] = "ctools"
  31. projects[] = "context"
  32. projects[] = "delta"
  33. ; Themes
  34. projects[] = "omega"';
  35. $actual = trim(file_get_contents($makefile));
  36. $this->assertEquals($expected, $actual);
  37. // Download a module to a 'contrib' directory to test the subdir feature
  38. mkdir($this->webroot() + '/sites/all/modules/contrib');
  39. $this->drush('pm-download', array('views'), array('destination' => 'sites/all/modules/contrib') + $options);
  40. $this->drush('pm-enable', array('views'), $options);
  41. $this->drush('generate-makefile', array($makefile), array('exclude-versions' => NULL) + $options);
  42. $expected = '; This file was auto-generated by drush make
  43. core = 7.x
  44. api = 2
  45. projects[] = "drupal"
  46. ; Modules
  47. projects[] = "adaptive_image"
  48. projects[] = "ctools"
  49. projects[] = "context"
  50. projects[] = "delta"
  51. projects[views][subdir] = "contrib"
  52. ; Themes
  53. projects[] = "omega"';
  54. $actual = trim(file_get_contents($makefile));
  55. $this->assertEquals($expected, $actual);
  56. // Generate a makefile with version numbers.
  57. $this->drush('generate-makefile', array($makefile), $options);
  58. $actual = file_get_contents($makefile);
  59. $this->assertContains('projects[adaptive_image][version] = "', $actual);
  60. }
  61. }