6 * Generate makefile tests
11 class generateMakeCase extends CommandUnishTestCase {
12 function testGenerateMake() {
13 return $this->_testGenerateMake('devel', 'bootstrap');
16 function testGenerateMakeOmega() {
17 # TODO: Don't skip this test by default once the underlying issue is resolved.
18 # See: https://github.com/drush-ops/drush/issues/2030
19 $run_omega_make_test = getenv("DRUSH_TEST_MAKE_OMEGA");
20 if ($run_omega_make_test) {
21 return $this->_testGenerateMake('devel', 'omega');
24 $this->markTestSkipped('Set `DRUSH_TEST_MAKE_OMEGA=1`, in order to run this test. See: https://github.com/drush-ops/drush/issues/2028');
28 function _testGenerateMake($module, $theme) {
29 $sites = $this->setUpDrupal(1, TRUE);
30 $major_version = UNISH_DRUPAL_MAJOR_VERSION . '.x';
35 'root' => $this->webroot(),
38 'strict' => 0, // Don't validate options
40 // Omega requires these core modules.
41 $this->drush('pm-enable', array('block', 'search', 'help'), $options);
42 $this->drush('pm-download', array($theme, $module), $options);
43 $this->drush('pm-enable', array($theme, $module), $options);
45 $makefile = UNISH_SANDBOX . '/dev.make.yml';
47 // First generate a simple makefile with no version information
48 $this->drush('generate-makefile', array($makefile), array('exclude-versions' => NULL) + $options);
57 $actual = trim(file_get_contents($makefile));
59 $this->assertEquals($expected, $actual);
61 // Next generate a simple makefile with no version information in .ini format
62 $makefile = UNISH_SANDBOX . '/dev.make';
63 $this->drush('generate-makefile', array($makefile), array('exclude-versions' => NULL, 'format' => 'ini') + $options);
65 ; This file was auto-generated by drush make
72 projects[] = "$module"
76 $actual = trim(file_get_contents($makefile));
78 $this->assertEquals($expected, $actual);
80 // Download a module to a 'contrib' directory to test the subdir feature
81 mkdir($this->webroot() + '/sites/all/modules/contrib');
82 $this->drush('pm-download', array('libraries'), array('destination' => 'sites/all/modules/contrib') + $options);
83 $this->drush('pm-enable', array('libraries'), $options);
84 $makefile = UNISH_SANDBOX . '/dev.make.yml';
85 $this->drush('generate-makefile', array($makefile), array('exclude-versions' => NULL) + $options);
96 $actual = trim(file_get_contents($makefile));
98 $this->assertEquals($expected, $actual);
100 // Again in .ini format.
101 $makefile = UNISH_SANDBOX . '/dev.make';
102 $this->drush('generate-makefile', array($makefile), array('exclude-versions' => NULL, 'format' => 'ini') + $options);
104 ; This file was auto-generated by drush make
105 core = $major_version
109 projects[] = "drupal"
111 projects[] = "$module"
112 projects[libraries][subdir] = "contrib"
115 projects[] = "$theme"
117 $actual = trim(file_get_contents($makefile));
119 $this->assertEquals($expected, $actual);
121 // Generate a makefile with version numbers (in .ini format).
122 $this->drush('generate-makefile', array($makefile), array('format' => 'ini') + $options);
123 $actual = file_get_contents($makefile);
124 $this->assertContains('projects[' . $module . '][version] = "', $actual);