Skip to content
Snippets Groups Projects
Commit 986fdecf authored by catch's avatar catch
Browse files

Issue #3184170 by BR0kEN, daffie, jonathanshaw, neclimdul, catch: The...

Issue #3184170 by BR0kEN, daffie, jonathanshaw, neclimdul, catch: The `releaseItem()` and `delayItem()` of `Drupal\Core\Queue\DatabaseQueue` violates interfaces return type specifications
parent c46c8680
Branches
Tags
7 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage"
......@@ -162,7 +162,7 @@ public function releaseItem($item) {
'expire' => 0,
])
->condition('item_id', $item->item_id);
return $update->execute();
return (bool) $update->execute();
}
catch (\Exception $e) {
$this->catchException($e);
......@@ -189,7 +189,7 @@ public function delayItem($item, int $delay) {
'expire' => $expire,
])
->condition('item_id', $item->item_id);
return $update->execute();
return (bool) $update->execute();
}
catch (\Exception $e) {
$this->catchException($e);
......
......@@ -182,4 +182,23 @@ public function testExceptions() {
$this->assertEquals(0, $queue->numberOfItems());
}
/**
* Tests that database queue implementation complies with interfaces specs.
*/
public function testDatabaseQueueReturnTypes(): void {
/** @var \Drupal\Core\Queue\DatabaseQueue $queue */
$queue = $this->container
->get('queue')
->get('cron_queue_test_database_delay_exception');
static::assertInstanceOf(DatabaseQueue::class, $queue);
$queue->createItem(12);
$item = $queue->claimItem();
static::assertTrue($queue->delayItem($item, 1));
static::assertTrue($queue->releaseItem($item));
$queue->deleteItem($item);
static::assertFalse($queue->delayItem($item, 1));
static::assertFalse($queue->releaseItem($item));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment