summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/search/search.test6
-rw-r--r--modules/simpletest/drupal_web_test_case.php8
-rw-r--r--modules/simpletest/tests/batch.test3
-rw-r--r--modules/simpletest/tests/graph.test8
4 files changed, 18 insertions, 7 deletions
diff --git a/modules/search/search.test b/modules/search/search.test
index 556a98a1f..7e97640c3 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -861,7 +861,8 @@ class SearchExpressionInsertExtractTestCase extends DrupalUnitTestCase {
}
function setUp() {
- parent::setUp('search');
+ drupal_load('module', 'search');
+ parent::setUp();
}
/**
@@ -1262,7 +1263,8 @@ class SearchExcerptTestCase extends DrupalUnitTestCase {
}
function setUp() {
- parent::setUp('search');
+ drupal_load('module', 'search');
+ parent::setUp();
}
/**
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 945cbe9d0..323825ac2 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -582,6 +582,14 @@ class DrupalUnitTestCase extends DrupalTestCase {
$this->skipClasses[__CLASS__] = TRUE;
}
+ /**
+ * Sets up unit test environment.
+ *
+ * Unlike DrupalWebTestCase::setUp(), DrupalUnitTestCase::setUp() does not
+ * install modules because tests are performed without accessing the database.
+ * Any required files must be explicitly included by the child class setUp()
+ * method.
+ */
protected function setUp() {
global $conf;
diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test
index d8aeb468c..36480a4ef 100644
--- a/modules/simpletest/tests/batch.test
+++ b/modules/simpletest/tests/batch.test
@@ -340,7 +340,7 @@ class BatchPercentagesUnitTestCase extends DrupalUnitTestCase {
// 19999/20000 should add yet another digit and go to 99.995%.
'99.995' => array('total' => 20000, 'current' => 19999),
);
-
+ require_once DRUPAL_ROOT . '/includes/batch.inc';
parent::setUp();
}
@@ -348,7 +348,6 @@ class BatchPercentagesUnitTestCase extends DrupalUnitTestCase {
* Test the _batch_api_percentage() function.
*/
function testBatchPercentages() {
- require_once DRUPAL_ROOT . '/includes/batch.inc';
foreach ($this->testCases as $expected_result => $arguments) {
// PHP sometimes casts numeric strings that are array keys to integers,
// cast them back here.
diff --git a/modules/simpletest/tests/graph.test b/modules/simpletest/tests/graph.test
index 70af3ff1e..36d91bf35 100644
--- a/modules/simpletest/tests/graph.test
+++ b/modules/simpletest/tests/graph.test
@@ -18,13 +18,15 @@ class GraphUnitTest extends DrupalUnitTestCase {
);
}
+ function setUp() {
+ require_once DRUPAL_ROOT . '/includes/graph.inc';
+ parent::setUp();
+ }
+
/**
* Test depth-first-search features.
*/
function testDepthFirstSearch() {
- // Provoke the inclusion of graph.inc.
- require_once DRUPAL_ROOT . '/includes/graph.inc';
-
// The sample graph used is:
// 1 --> 2 --> 3 5 ---> 6
// | ^ ^