forked from drush-ops/drush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpmEnDisUnListInfoTest.php
97 lines (84 loc) · 3.77 KB
/
pmEnDisUnListInfoTest.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* @file
* Tests for enable, disable, uninstall, pm-list commands.
*/
namespace Unish;
/**
* @group slow
* @group pm
*/
class EnDisUnListInfoCase extends CommandUnishTestCase {
public function testEnDisUnList() {
$sites = $this->setUpDrupal(1, TRUE);
$options_no_pipe = array(
'yes' => NULL,
'root' => $this->webroot(),
'uri' => key($sites),
'cache' => NULL,
'skip' => NULL, // No FirePHP
'strict' => 0, // Don't validate options
);
$options = $options_no_pipe + array(
'pipe' => NULL,
);
$this->drush('pm-download', array('devel'), $options);
$this->drush('pm-list', array(), $options + array('no-core' => NULL, 'status' => 'disabled,not installed'));
$out = $this->getOutput();
$list = $this->getOutputAsList();
$this->assertTrue(in_array('devel', $list));
$this->drush('pm-enable', array('devel'), $options_no_pipe);
$output = $this->getOutput();
$this->assertContains('access devel information', $output);
$this->drush('pm-info', array('devel'), $options);
$output = $this->getOutputFromJSON('devel');
$expected = array(
'extension' => 'devel',
'project' => 'devel',
'type' => 'module',
'title' => 'Devel',
'status' => 'enabled',
);
foreach ($expected as $key => $value) {
$this->assertEquals($expected[$key], $value);
}
$this->drush('pm-list', array(), $options + array('status' => 'enabled'));
$list = $this->getOutputAsList();
$this->assertTrue(in_array('devel', $list));
// In D7, the testing profile uses 'bartik', whereas in D8, 'stark' is used.
$themeToCheck = UNISH_DRUPAL_MAJOR_VERSION >= 8 ? 'stark' : (UNISH_DRUPAL_MAJOR_VERSION == 7 ? 'bartik' : 'garland');
$this->assertTrue(in_array($themeToCheck, $list), 'Themes are in the pm-list');
$path = UNISH_DRUPAL_MAJOR_VERSION >= 7 ? 'devel/settings' : 'admin/settings/devel';
$this->drush('sql-query', array("SELECT path FROM menu_router WHERE path = '$path';"), array('root' => $this->webroot(), 'uri' => key($sites)));
$list = $this->getOutputAsList();
$this->assertTrue(in_array($path, $list), 'Cache was cleared after modules were enabled');
$this->drush('pm-list', array(), $options + array('package' => 'Core'));
$list = $this->getOutputAsList();
$this->assertFalse(in_array('devel', $list), 'Devel is not part of core package');
if (UNISH_DRUPAL_MAJOR_VERSION <= 7) {
$this->drush('pm-disable', array('devel'), $options);
$this->drush('pm-list', array(), $options + array('status' => 'disabled'));
$list = $this->getOutputAsList();
$this->assertTrue(in_array('devel', $list));
}
$this->drush('pm-uninstall', array('devel'), $options);
$this->drush('pm-list', array(), $options + array('status' => 'not installed', 'type' => 'module'));
$list = $this->getOutputAsList();
$this->assertTrue(in_array('devel', $list));
// Test pm-enable is able to download dependencies.
if (UNISH_DRUPAL_MAJOR_VERSION >= 8) {
$this->markTestSkipped("pathauto does not have a release for Drupal 8 yet.");
}
$this->drush('pm-download', array('pathauto'), $options);
$this->drush('pm-enable', array('pathauto'), $options + array('resolve-dependencies' => TRUE));
$this->drush('pm-list', array(), $options + array('status' => 'enabled'));
$list = $this->getOutputAsList();
$this->assertTrue(in_array('token', $list));
// Test that pm-enable downloads missing projects and dependencies.
$this->drush('pm-enable', array('views'), $options + array('resolve-dependencies' => TRUE));
$this->drush('pm-list', array(), $options + array('status' => 'enabled'));
$list = $this->getOutputAsList();
// @todo fails in D6
$this->assertTrue(in_array('ctools', $list));
}
}