function UpdateCoreTestCase::testFetchTasks in Drupal 7
Tests that exactly one fetch task per project is created and not more.
File
- modules/
update/ update.test, line 239 - This file contains tests for the Update Manager module.
Class
- UpdateCoreTestCase
- Tests behavior related to discovering and listing updates to Drupal core.
Code
function testFetchTasks() {
$projecta = array(
'name' => 'aaa_update_test',
);
$projectb = array(
'name' => 'bbb_update_test',
);
$queue = DrupalQueue::get('update_fetch_tasks');
$this
->assertEqual($queue
->numberOfItems(), 0, 'Queue is empty');
update_create_fetch_task($projecta);
$this
->assertEqual($queue
->numberOfItems(), 1, 'Queue contains one item');
update_create_fetch_task($projectb);
$this
->assertEqual($queue
->numberOfItems(), 2, 'Queue contains two items');
// Try to add project a again.
update_create_fetch_task($projecta);
$this
->assertEqual($queue
->numberOfItems(), 2, 'Queue still contains two items');
// Clear cache and try again.
_update_cache_clear();
drupal_static_reset('_update_create_fetch_task');
update_create_fetch_task($projecta);
$this
->assertEqual($queue
->numberOfItems(), 2, 'Queue contains two items');
}