Commit 0c01d924 authored by catch's avatar catch

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

(cherry picked from commit 986fdecf)
parent f0bc5dee
......@@ -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));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment