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