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