Tests the Update Manager module when the update server returns 503 errors.

File

modules/update/update.test, line 229
This file contains tests for the Update Manager module.

Class

UpdateCoreTestCase
Tests behavior related to discovering and listing updates to Drupal core.

Code

function testServiceUnavailable() {
  $this
    ->refreshUpdateStatus(array(), '503-error');

  // Ensure that no "Warning: SimpleXMLElement..." parse errors are found.
  $this
    ->assertNoText('SimpleXMLElement');
  $this
    ->assertUniqueText(t('Failed to get available update data for one project.'));
  $update_log = db_query_range('SELECT message FROM {watchdog} WHERE type = :type ORDER BY wid DESC', 0, 1, array(
    ':type' => 'update',
  ))
    ->fetchField();
  $this
    ->assertEqual('Error %errorcode (%message) occurred when trying to fetch available update data for the project %project.', $update_log, 'Failed update logged');
}