public function QueueWorkerLockedTest::testUploadLockedDoNotProcessQueueIfLockIsAlreadyAcquired in TMGMT Extension Suite 8.3
Upload queue worker: do not process queue if lock is already acquired.
File
- tests/
src/ Kernel/ QueueWorkerLockedTest.php, line 155
Class
- QueueWorkerLockedTest
- Tests locked queues.
Namespace
Drupal\Tests\tmgmt_extension_suit\KernelCode
public function testUploadLockedDoNotProcessQueueIfLockIsAlreadyAcquired() {
$lockId = get_class($this->uploadQueueWorker) . ':processItem';
$this->uploadQueueWorker
->expects($this
->never())
->method('doProcessItem');
$this->lockMock
->expects($this
->once())
->method('acquire')
->with($lockId, 27)
->willReturn(FALSE);
$this->lockMock
->expects($this
->never())
->method('release');
try {
$this->uploadQueueWorker
->processItem([
"foo" => "bar",
]);
} catch (RequeueException $e) {
$this
->assertEquals("Attempting to re-acquire {$lockId}.", $e
->getMessage());
}
}