diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-13 02:14:05 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-13 02:14:05 +0000 |
commit | 9058a8984d76ae238bdc3a45a1c41dfa9012445c (patch) | |
tree | a9dfd57d0dc97b22f4199eda99dc196ba6ba458d /modules/update/update.test | |
parent | cad226e60bc5827050789d4900f1a17907c203d3 (diff) | |
download | brdo-9058a8984d76ae238bdc3a45a1c41dfa9012445c.tar.gz brdo-9058a8984d76ae238bdc3a45a1c41dfa9012445c.tar.bz2 |
- Patch #597484 by dww: use the Queue API to fetch available update data.
Diffstat (limited to 'modules/update/update.test')
-rw-r--r-- | modules/update/update.test | 115 |
1 files changed, 107 insertions, 8 deletions
diff --git a/modules/update/update.test b/modules/update/update.test index e6c819482..7c5a2f0f8 100644 --- a/modules/update/update.test +++ b/modules/update/update.test @@ -74,7 +74,6 @@ class UpdateCoreTestCase extends UpdateTestHelper { function testNoUpdatesAvailable() { $this->setSystemInfo7_0(); $this->refreshUpdateStatus(array('drupal' => '0')); - $this->drupalGet('admin/reports/updates'); $this->standardTests(); $this->assertText(t('Up to date')); $this->assertNoText(t('Update available')); @@ -87,7 +86,6 @@ class UpdateCoreTestCase extends UpdateTestHelper { function testNormalUpdateAvailable() { $this->setSystemInfo7_0(); $this->refreshUpdateStatus(array('drupal' => '1')); - $this->drupalGet('admin/reports/updates'); $this->standardTests(); $this->assertNoText(t('Up to date')); $this->assertText(t('Update available')); @@ -103,7 +101,6 @@ class UpdateCoreTestCase extends UpdateTestHelper { function testSecurityUpdateAvailable() { $this->setSystemInfo7_0(); $this->refreshUpdateStatus(array('drupal' => '2-sec')); - $this->drupalGet('admin/reports/updates'); $this->standardTests(); $this->assertNoText(t('Up to date')); $this->assertNoText(t('Update available')); @@ -130,13 +127,63 @@ class UpdateCoreTestCase extends UpdateTestHelper { ); variable_set('update_test_system_info', $system_info); $this->refreshUpdateStatus(array('drupal' => 'dev')); - $this->drupalGet('admin/reports/updates'); $this->assertNoText(t('2001-Sep-')); $this->assertText(t('Up to date')); $this->assertNoText(t('Update available')); $this->assertNoText(t('Security update required!')); } + /** + * Check the messages at admin/config/modules when the site is up to date. + */ + function testModulePageUpToDate() { + $this->setSystemInfo7_0(); + // Instead of using refreshUpdateStatus(), set these manually. + variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE))); + variable_set('update_test_xml_map', array('drupal' => '0')); + + $this->drupalGet('admin/config/modules'); + $this->assertText(t('No information is available about potential new releases for currently installed modules and themes.')); + $this->clickLink(t('check manually')); + $this->assertText(t('Checked available update data for one project.')); + $this->assertNoText(t('There are updates available for your version of Drupal.')); + $this->assertNoText(t('There is a security update available for your version of Drupal.')); + } + + /** + * Check the messages at admin/config/modules when missing an update. + */ + function testModulePageRegularUpdate() { + $this->setSystemInfo7_0(); + // Instead of using refreshUpdateStatus(), set these manually. + variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE))); + variable_set('update_test_xml_map', array('drupal' => '1')); + + $this->drupalGet('admin/config/modules'); + $this->assertText(t('No information is available about potential new releases for currently installed modules and themes.')); + $this->clickLink(t('check manually')); + $this->assertText(t('Checked available update data for one project.')); + $this->assertText(t('There are updates available for your version of Drupal.')); + $this->assertNoText(t('There is a security update available for your version of Drupal.')); + } + + /** + * Check the messages at admin/config/modules when missing a security update. + */ + function testModulePageSecurityUpdate() { + $this->setSystemInfo7_0(); + // Instead of using refreshUpdateStatus(), set these manually. + variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE))); + variable_set('update_test_xml_map', array('drupal' => '2-sec')); + + $this->drupalGet('admin/config/modules'); + $this->assertText(t('No information is available about potential new releases for currently installed modules and themes.')); + $this->clickLink(t('check manually')); + $this->assertText(t('Checked available update data for one project.')); + $this->assertNoText(t('There are updates available for your version of Drupal.')); + $this->assertText(t('There is a security update available for your version of Drupal.')); + } + protected function setSystemInfo7_0() { $setting = array( '#all' => array( @@ -185,7 +232,6 @@ class UpdateTestContribCase extends UpdateTestHelper { 'aaa_update_test' => '1_0', ) ); - $this->drupalGet('admin/reports/updates'); $this->standardTests(); $this->assertText(t('Up to date')); $this->assertRaw('<h3>' . t('Modules') . '</h3>'); @@ -240,7 +286,6 @@ class UpdateTestContribCase extends UpdateTestHelper { ); variable_set('update_test_system_info', $system_info); $this->refreshUpdateStatus(array('drupal' => '0', '#all' => '1_0')); - $this->drupalGet('admin/reports/updates'); $this->standardTests(); // We're expecting the report to say all projects are up to date. $this->assertText(t('Up to date')); @@ -303,7 +348,6 @@ class UpdateTestContribCase extends UpdateTestHelper { 'update_test_basetheme' => '1_1-sec', ); $this->refreshUpdateStatus($xml_mapping); - $this->drupalGet('admin/reports/updates'); $this->assertText(t('Security update required!')); $this->assertRaw(l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'), t('Link to the Update test base theme project appears.')); } @@ -349,7 +393,6 @@ class UpdateTestContribCase extends UpdateTestHelper { foreach (array(TRUE, FALSE) as $check_disabled) { variable_set('update_check_disabled', $check_disabled); $this->refreshUpdateStatus($xml_mapping); - $this->drupalGet('admin/reports/updates'); // In neither case should we see the "Themes" heading for enabled themes. $this->assertNoText(t('Themes')); if ($check_disabled) { @@ -365,5 +408,61 @@ class UpdateTestContribCase extends UpdateTestHelper { } } + /** + * Make sure that if we fetch from a broken URL, sane things happen. + */ + function testUpdateBrokenFetchURL() { + $system_info = array( + '#all' => array( + 'version' => '7.0', + ), + 'aaa_update_test' => array( + 'project' => 'aaa_update_test', + 'version' => '7.x-1.0', + 'hidden' => FALSE, + ), + 'bbb_update_test' => array( + 'project' => 'bbb_update_test', + 'version' => '7.x-1.0', + 'hidden' => FALSE, + ), + 'ccc_update_test' => array( + 'project' => 'ccc_update_test', + 'version' => '7.x-1.0', + 'hidden' => FALSE, + ), + ); + variable_set('update_test_system_info', $system_info); + + $xml_mapping = array( + 'drupal' => '0', + 'aaa_update_test' => '1_0', + 'bbb_update_test' => 'does-not-exist', + 'ccc_update_test' => '1_0', + ); + $this->refreshUpdateStatus($xml_mapping); + + $this->assertText(t('Up to date')); + // We're expecting the report to say most projects are up to date, so we + // hope that 'Up to date' is not unique. + $this->assertNoUniqueText(t('Up to date')); + // It should say we failed to get data, not that we're missing an update. + $this->assertNoText(t('Update available')); + + // We need to check that this string is found as part of a project row, + // not just in the "Failed to get available update data for ..." message + // at the top of the page. + $this->assertRaw('<div class="version-status">' . t('Failed to get available update data')); + + // We should see the output messages from fetching manually. + $this->assertUniqueText(t('Checked available update data for 3 projects.')); + $this->assertUniqueText(t('Failed to get available update data for one project.')); + + // The other two should be listed as projects. + $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project appears.')); + $this->assertNoRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), t('Link to bbb_update_test project does not appear.')); + $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), t('Link to bbb_update_test project appears.')); + } + } |