summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/update.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests/update.test')
-rw-r--r--modules/simpletest/tests/update.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/simpletest/tests/update.test b/modules/simpletest/tests/update.test
index 0809690e6..c4d382847 100644
--- a/modules/simpletest/tests/update.test
+++ b/modules/simpletest/tests/update.test
@@ -86,3 +86,31 @@ class UpdateDependencyMissingTestCase extends DrupalWebTestCase {
}
}
+/**
+ * Tests for the invocation of hook_update_dependencies().
+ */
+class UpdateDependencyHookInvocationTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Update dependency hook invocation',
+ 'description' => 'Test that the hook invocation for determining update dependencies works correctly.',
+ 'group' => 'Update API',
+ );
+ }
+
+ function setUp() {
+ parent::setUp('update_test_1', 'update_test_2');
+ require_once DRUPAL_ROOT . '/includes/update.inc';
+ }
+
+ /**
+ * Test the structure of the array returned by hook_update_dependencies().
+ */
+ function testHookUpdateDependencies() {
+ $update_dependencies = update_retrieve_dependencies();
+ $this->assertTrue($update_dependencies['system'][7000]['update_test_1'] == 7000, t('An update function that has a dependency on two separate modules has the first dependency recorded correctly.'));
+ $this->assertTrue($update_dependencies['system'][7000]['update_test_2'] == 7001, t('An update function that has a dependency on two separate modules has the second dependency recorded correctly.'));
+ $this->assertTrue($update_dependencies['system'][7001]['update_test_1'] == 7002, t('An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.'));
+ }
+}
+