function UpdateCoreTest::testFetchTasks
Tests that exactly one fetch task per project is created and not more.
File
-
core/
modules/ update/ tests/ src/ Functional/ UpdateCoreTest.php, line 777
Class
- UpdateCoreTest
- Tests the Update Manager module through a series of functional tests using mock XML data.
Namespace
Drupal\Tests\update\FunctionalCode
public function testFetchTasks() {
$projecta = [
'name' => 'aaa_update_test',
];
$projectb = [
'name' => 'bbb_update_test',
];
$queue = \Drupal::queue('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 storage and try again.
update_storage_clear();
update_create_fetch_task($projecta);
$this->assertEqual($queue->numberOfItems(), 2, 'Queue contains two items');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.