forked from drush-ops/drush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariableTest.php
52 lines (43 loc) · 2.04 KB
/
variableTest.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
<?php
namespace Unish;
/**
* @group commands
*/
class VariableCase extends CommandUnishTestCase {
function testVariable() {
if (UNISH_DRUPAL_MAJOR_VERSION >= 8) {
$this->markTestSkipped("Variable system was removed in Drupal 8.");
}
$sites = $this->setUpDrupal(1, TRUE);
$options = array(
'yes' => NULL,
'pipe' => NULL,
'root' => $this->webroot(),
'uri' => key($sites),
);
$this->drush('variable-set', array('test_integer', '3.14159'), $options);
$this->drush('variable-get', array('test_integer'), $options);
$var_export = $this->getOutput();
eval($var_export);
$this->assertEquals("3.14159", $variables['test_integer'], 'Integer variable was successfully set and get.');
$this->drush('variable-set', array('date_default_timezone', 'US/Mountain'), $options);
$this->drush('variable-get', array('date_default_timezone'), $options); // Wildcard get.
$var_export = $this->getOutput();
eval($var_export);
$this->assertEquals('US/Mountain', $variables['date_default_timezone'], 'Variable was successfully set and get.');
$this->drush('variable-set', array('site_name', 'control'), $options + array('exact' => NULL));
$this->drush('variable-set', array('site_na', 'unish'), $options + array('always-set' => NULL));
$this->drush('variable-get', array('site_na'), $options + array('exact' => NULL));
$var_export = $this->getOutput();
eval($var_export);
$this->assertEquals('unish', $variables['site_na'], '--always-set option works as expected.');
$this->drush('variable-set', array('site_n', 'exactish'), $options + array('exact' => NULL));
$this->drush('variable-get', array('site_n'), $options + array('exact' => NULL));
$var_export = $this->getOutput();
eval($var_export);
$this->assertEquals('exactish', $variables['site_n'], '--exact option works as expected.');
$this->drush('variable-delete', array('site_name'), $options);
$output = $this->getOutput();
$this->assertEmpty($output, 'Variable was successfully deleted.');
}
}