From 6a4064e3d4ba1232e8de661a0efb6ab1bcbb0870 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 1 Oct 2009 19:23:21 +0000 Subject: - Patch #591632 by dww | chx: Changed Refactor tests to allow testing contrib. --- modules/update/tests/aaa_update_test.1_0.xml | 34 ++++++++++++++ modules/update/tests/aaa_update_test.info | 7 +++ modules/update/tests/aaa_update_test.module | 7 +++ modules/update/tests/bbb_update_test.1_0.xml | 34 ++++++++++++++ modules/update/tests/bbb_update_test.info | 7 +++ modules/update/tests/bbb_update_test.module | 7 +++ modules/update/tests/ccc_update_test.1_0.xml | 34 ++++++++++++++ modules/update/tests/ccc_update_test.info | 7 +++ modules/update/tests/ccc_update_test.module | 7 +++ modules/update/tests/dev-snapshot.xml | 50 -------------------- modules/update/tests/drupal.0.xml | 34 ++++++++++++++ modules/update/tests/drupal.1.xml | 51 ++++++++++++++++++++ modules/update/tests/drupal.2-sec.xml | 69 ++++++++++++++++++++++++++++ modules/update/tests/drupal.dev.xml | 50 ++++++++++++++++++++ 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.module | 30 ++++++++++-- 18 files changed, 373 insertions(+), 209 deletions(-) create mode 100644 modules/update/tests/aaa_update_test.1_0.xml create mode 100644 modules/update/tests/aaa_update_test.info create mode 100644 modules/update/tests/aaa_update_test.module create mode 100644 modules/update/tests/bbb_update_test.1_0.xml create mode 100644 modules/update/tests/bbb_update_test.info create mode 100644 modules/update/tests/bbb_update_test.module create mode 100644 modules/update/tests/ccc_update_test.1_0.xml create mode 100644 modules/update/tests/ccc_update_test.info create mode 100644 modules/update/tests/ccc_update_test.module delete mode 100644 modules/update/tests/dev-snapshot.xml create mode 100644 modules/update/tests/drupal.0.xml create mode 100644 modules/update/tests/drupal.1.xml create mode 100644 modules/update/tests/drupal.2-sec.xml create mode 100644 modules/update/tests/drupal.dev.xml delete mode 100644 modules/update/tests/no-updates.xml delete mode 100644 modules/update/tests/normal-update.xml delete mode 100644 modules/update/tests/security-update.xml (limited to 'modules/update/tests') diff --git a/modules/update/tests/aaa_update_test.1_0.xml b/modules/update/tests/aaa_update_test.1_0.xml new file mode 100644 index 000000000..a168453f0 --- /dev/null +++ b/modules/update/tests/aaa_update_test.1_0.xml @@ -0,0 +1,34 @@ + + +AAA Update test +aaa_update_test +Drupal +7.x +1 +1 +1 +published +http://example.com/project/aaa_update_test + + ProjectsModules + + + + aaa_update_test 7.x-1.0 + 7.x-1.0 + DRUPAL-7--1-0 + 1 + 0 + published + http://example.com/aaa_update_test-7-x-1-0-release + http://example.com/aaa_update_test-7.x-1.0.tar.gz + 1250424521 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/modules/update/tests/aaa_update_test.info b/modules/update/tests/aaa_update_test.info new file mode 100644 index 000000000..634d9840d --- /dev/null +++ b/modules/update/tests/aaa_update_test.info @@ -0,0 +1,7 @@ +; $Id$ +name = AAA Update test +description = Support module for update module testing. +package = Testing +core = 7.x +files[] = aaa_update_test.module +hidden = TRUE diff --git a/modules/update/tests/aaa_update_test.module b/modules/update/tests/aaa_update_test.module new file mode 100644 index 000000000..da4699c05 --- /dev/null +++ b/modules/update/tests/aaa_update_test.module @@ -0,0 +1,7 @@ + + +BBB Update test +bbb_update_test +Drupal +7.x +1 +1 +1 +published +http://example.com/project/bbb_update_test + + ProjectsModules + + + + bbb_update_test 7.x-1.0 + 7.x-1.0 + DRUPAL-7--1-0 + 1 + 0 + published + http://example.com/bbb_update_test-7-x-1-0-release + http://example.com/bbb_update_test-7.x-1.0.tar.gz + 1250424521 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/modules/update/tests/bbb_update_test.info b/modules/update/tests/bbb_update_test.info new file mode 100644 index 000000000..d322dc375 --- /dev/null +++ b/modules/update/tests/bbb_update_test.info @@ -0,0 +1,7 @@ +; $Id$ +name = BBB Update test +description = Support module for update module testing. +package = Testing +core = 7.x +files[] = bbb_update_test.module +hidden = TRUE diff --git a/modules/update/tests/bbb_update_test.module b/modules/update/tests/bbb_update_test.module new file mode 100644 index 000000000..da4699c05 --- /dev/null +++ b/modules/update/tests/bbb_update_test.module @@ -0,0 +1,7 @@ + + +CCC Update test +ccc_update_test +Drupal +7.x +1 +1 +1 +published +http://example.com/project/ccc_update_test + + ProjectsModules + + + + ccc_update_test 7.x-1.0 + 7.x-1.0 + DRUPAL-7--1-0 + 1 + 0 + published + http://example.com/ccc_update_test-7-x-1-0-release + http://example.com/ccc_update_test-7.x-1.0.tar.gz + 1250424521 + b966255555d9c9b86d480ca08cfaa98e + 1073741824 + + Release typeNew features + Release typeBug fixes + + + + diff --git a/modules/update/tests/ccc_update_test.info b/modules/update/tests/ccc_update_test.info new file mode 100644 index 000000000..a4eb3ea06 --- /dev/null +++ b/modules/update/tests/ccc_update_test.info @@ -0,0 +1,7 @@ +; $Id$ +name = CCC Update test +description = Support module for update module testing. +package = Testing +core = 7.x +files[] = ccc_update_test.module +hidden = TRUE diff --git a/modules/update/tests/ccc_update_test.module b/modules/update/tests/ccc_update_test.module new file mode 100644 index 000000000..da4699c05 --- /dev/null +++ b/modules/update/tests/ccc_update_test.module @@ -0,0 +1,7 @@ + - -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 - - - - Drupal 7.x-dev - 7.x-dev - DRUPAL-7 - 7 - dev - published - http://example.com/drupal-7-x-dev-release - http://example.com/drupal-7.x-dev.tar.gz - 1250424581 - b966255555d9c9b86d480ca08cfaa98e - 2147483648 - - Release typeBug fixes - - - - diff --git a/modules/update/tests/drupal.0.xml b/modules/update/tests/drupal.0.xml new file mode 100644 index 000000000..701e11e3e --- /dev/null +++ b/modules/update/tests/drupal.0.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/drupal.1.xml b/modules/update/tests/drupal.1.xml new file mode 100644 index 000000000..de4cfd004 --- /dev/null +++ b/modules/update/tests/drupal.1.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/drupal.2-sec.xml b/modules/update/tests/drupal.2-sec.xml new file mode 100644 index 000000000..1e68c8d5f --- /dev/null +++ b/modules/update/tests/drupal.2-sec.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/drupal.dev.xml b/modules/update/tests/drupal.dev.xml new file mode 100644 index 000000000..49dcc3f5f --- /dev/null +++ b/modules/update/tests/drupal.dev.xml @@ -0,0 +1,50 @@ + + +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 + + + + Drupal 7.x-dev + 7.x-dev + DRUPAL-7 + 7 + dev + published + http://example.com/drupal-7-x-dev-release + http://example.com/drupal-7.x-dev.tar.gz + 1250424581 + b966255555d9c9b86d480ca08cfaa98e + 2147483648 + + Release typeBug fixes + + + + diff --git a/modules/update/tests/no-updates.xml b/modules/update/tests/no-updates.xml deleted file mode 100644 index 701e11e3e..000000000 --- a/modules/update/tests/no-updates.xml +++ /dev/null @@ -1,34 +0,0 @@ - - -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 deleted file mode 100644 index de4cfd004..000000000 --- a/modules/update/tests/normal-update.xml +++ /dev/null @@ -1,51 +0,0 @@ - - -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 deleted file mode 100644 index 1e68c8d5f..000000000 --- a/modules/update/tests/security-update.xml +++ /dev/null @@ -1,69 +0,0 @@ - - -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.module b/modules/update/tests/update_test.module index 54e497415..f95a5cb9a 100644 --- a/modules/update/tests/update_test.module +++ b/modules/update/tests/update_test.module @@ -41,10 +41,30 @@ function update_test_system_info_alter(&$info, $file) { /** * Page callback, prints mock XML for the update module. + * + * The specific XML file to print depends on two things: the project we're + * trying to fetch data for, and the desired "availability scenario" for that + * project which we're trying to test. Before attempting to fetch this data + * (by checking for updates on the available updates report), callers need to + * define the 'update_test_xml_map' variable as an array, keyed by project + * name, indicating which availability scenario to use for that project. + * + * @param $project_name + * The project short name update.module is trying to fetch data for (the + * fetch URLs are of the form: [base_url]/[project_name]/[core_version]). */ -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"); +function update_test_mock_page($project_name) { + $xml_map = variable_get('update_test_xml_map', FALSE); + if (isset($xml_map[$project_name])) { + $availability_scenario = $xml_map[$project_name]; + } + elseif (isset($xml_map['#all'])) { + $availability_scenario = $xml_map['#all']; + } + else { + return FALSE; + } + + $path = drupal_get_path('module', 'update_test'); + readfile("$path/$project_name.$availability_scenario.xml"); } -- cgit v1.2.3