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

Namespace

Unish

Classes

Namesort descending Description
generateMakeCase Generate makefile tests

File

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