forked from drush-ops/drush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsiteIntallD6Test.php
78 lines (68 loc) · 2.11 KB
/
siteIntallD6Test.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
<?php
namespace Unish;
/**
* Tests for site-install on a Drupal 6 installation.
*
* @group commands
*/
class siteInstallD6Case extends CommandUnishTestCase {
function setUp() {
if (UNISH_DRUPAL_MAJOR_VERSION != 6) {
$this->markTestSkipped('This test class is designed for Drupal 6.');
return;
}
}
/**
* Test a D6 install with extra options.
*/
public function testExtraConfigurationOptions() {
// Set up codebase without installing Drupal.
$sites = $this->setUpDrupal(1, FALSE, '6');
$root = $this->webroot();
$site = key($sites);
// Copy the "example" test profile into the newly created site's profiles directory
$profile_dir = "$root/profiles/example";
mkdir($profile_dir);
copy(dirname(__FILE__) . '/resources/example.profile', $profile_dir . '/example.profile');
$test_string = $this->randomString();
// example.profile Has values 0-2 defined as allowed.
$test_int = rand(0, 2);
$site_name = $this->randomString();
$this->drush('site-install', array(
// First argument is the profile name
'example',
// Then the extra profile options
"myopt1=$test_string",
"myopt2=$test_int",
),
array(
'db-url' => $this->db_url($site),
'yes' => NULL,
'sites-subdir' => $site,
'root' => $root,
'site-name' => $site_name,
'uri' => $site,
));
$this->checkVariable('site_name', $site_name, $site);
$this->checkVariable('myopt1', $test_string, $site);
$this->checkVariable('myopt2', $test_int, $site);
}
/**
* Check the value of a Drupal variable against an expectation using drush.
*
* @param $name
* The variable name.
* @param $value
* The expected value of this variable.
* @param $site
* The name of an individual multisite installation site.
*/
private function checkVariable($name, $value, $site) {
$options = array(
'root' => $this->webroot(),
'uri' => $site,
);
$this->drush('variable-get', array($name), $options);
$this->assertEquals("$name: '$value'", $this->getOutput());
}
}