From bf7175abe5735bd304246bfc353dfdb7078f747c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 26 Sep 2009 17:03:13 +0000 Subject: - Patch #253501 by dww, cwgordon7 | boombatower, Dave Reid: added tests for update.module. --- modules/update/tests/no-updates.xml | 34 ++++++++++++++++ modules/update/tests/normal-update.xml | 51 +++++++++++++++++++++++ modules/update/tests/security-update.xml | 69 ++++++++++++++++++++++++++++++++ modules/update/tests/update_test.info | 8 ++++ modules/update/tests/update_test.module | 50 +++++++++++++++++++++++ 5 files changed, 212 insertions(+) create mode 100644 modules/update/tests/no-updates.xml create mode 100644 modules/update/tests/normal-update.xml create mode 100644 modules/update/tests/security-update.xml create mode 100644 modules/update/tests/update_test.info create mode 100644 modules/update/tests/update_test.module (limited to 'modules/update/tests') diff --git a/modules/update/tests/no-updates.xml b/modules/update/tests/no-updates.xml new file mode 100644 index 000000000..701e11e3e --- /dev/null +++ b/modules/update/tests/no-updates.xml @@ -0,0 +1,34 @@ + + +Drupal +drupal +Drupal +7.x +7 +7 +7 +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 7.0 + 7.0 + DRUPAL-7-0 + 7 + 0 + published + http://example.com/drupal-7-0-release + http://example.com/drupal-7-0.tar.gz + 1250424521 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/modules/update/tests/normal-update.xml b/modules/update/tests/normal-update.xml new file mode 100644 index 000000000..de4cfd004 --- /dev/null +++ b/modules/update/tests/normal-update.xml @@ -0,0 +1,51 @@ + + +Drupal +drupal +Drupal +7.x +7 +7 +7 +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 7.1 + 7.1 + DRUPAL-7-1 + 7 + 1 + published + http://example.com/drupal-7-1-release + http://example.com/drupal-7-1.tar.gz + 1250424581 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeNew features + Release typeBug fixes + + + + Drupal 7.0 + 7.0 + DRUPAL-7-0 + 7 + 0 + published + http://example.com/drupal-7-0-release + http://example.com/drupal-7-0.tar.gz + 1250424521 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/modules/update/tests/security-update.xml b/modules/update/tests/security-update.xml new file mode 100644 index 000000000..1e68c8d5f --- /dev/null +++ b/modules/update/tests/security-update.xml @@ -0,0 +1,69 @@ + + +Drupal +drupal +Drupal +7.x +7 +7 +7 +published +http://example.com/project/drupal + + ProjectsDrupal project + + + + Drupal 7.2 + 7.2 + DRUPAL-7-2 + 7 + 2 + published + http://example.com/drupal-7-2-release + http://example.com/drupal-7-2.tar.gz + 1250424641 + b966255555d9c9b86d480ca08cfaa98e + 4294967296 + + Release typeNew features + Release typeBug fixes + Release typeSecurity update + + + + Drupal 7.1 + 7.1 + DRUPAL-7-1 + 7 + 1 + published + http://example.com/drupal-7-1-release + http://example.com/drupal-7-1.tar.gz + 1250424581 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeNew features + Release typeBug fixes + + + + Drupal 7.0 + 7.0 + DRUPAL-7-0 + 7 + 0 + published + http://example.com/drupal-7-0-release + http://example.com/drupal-7-0.tar.gz + 1250424521 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/modules/update/tests/update_test.info b/modules/update/tests/update_test.info new file mode 100644 index 000000000..10445c297 --- /dev/null +++ b/modules/update/tests/update_test.info @@ -0,0 +1,8 @@ +; $Id$ +name = Update test +description = Support module for update module testing. +package = Testing +version = VERSION +core = 7.x +files[] = update_test.module +hidden = TRUE diff --git a/modules/update/tests/update_test.module b/modules/update/tests/update_test.module new file mode 100644 index 000000000..54e497415 --- /dev/null +++ b/modules/update/tests/update_test.module @@ -0,0 +1,50 @@ + t('Update test'), + 'page callback' => 'update_test_mock_page', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + + return $items; +} + +/** + * Implement hook_system_info_alter(). + * + * This checks the 'update_test_system_info' variable and sees if we need to + * alter the system info for the given $file based on the setting. The setting + * is expected to be a nested associative array. If the key '#all' is defined, + * its subarray will include .info keys and values for all modules and themes + * on the system. Otherwise, the settings array is keyed by the module or + * theme short name ($file->name) and the subarrays contain settings just for + * that module or theme. + */ +function update_test_system_info_alter(&$info, $file) { + $setting = variable_get('update_test_system_info', array()); + foreach (array('#all', $file->name) as $id) { + if (!empty($setting[$id])) { + foreach ($setting[$id] as $key => $value) { + $info[$key] = $value; + } + } + } +} + +/** + * Page callback, prints mock XML for the update module. + */ +function update_test_mock_page() { + $xml = variable_get('update_test_xml', FALSE); + // Note: this will cause an exception to occur if no variable was set and + // $file is FALSE. + readfile(drupal_get_path('module', 'update_test') . "/$xml"); +} -- cgit v1.2.3