function UpdateSemverCoreTest::testFetchTasks
Same name in other branches
- 10 core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php \Drupal\Tests\update\Functional\UpdateSemverCoreTest::testFetchTasks()
- 11.x core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php \Drupal\Tests\update\Functional\UpdateSemverCoreTest::testFetchTasks()
Tests that exactly one fetch task per project is created and not more.
File
-
core/
modules/ update/ tests/ src/ Functional/ UpdateSemverCoreTest.php, line 447
Class
- UpdateSemverCoreTest
- Tests the semantic version handling in the Update Manager.
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->assertEquals(0, $queue->numberOfItems(), 'Queue is empty');
update_create_fetch_task($projecta);
$this->assertEquals(1, $queue->numberOfItems(), 'Queue contains one item');
update_create_fetch_task($projectb);
$this->assertEquals(2, $queue->numberOfItems(), 'Queue contains two items');
// Try to add a project again.
update_create_fetch_task($projecta);
$this->assertEquals(2, $queue->numberOfItems(), 'Queue still contains two items');
// Clear storage and try again.
update_storage_clear();
update_create_fetch_task($projecta);
$this->assertEquals(2, $queue->numberOfItems(), 'Queue contains two items');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.