public function ServiceTest::testRelease in Purge 8.3
Tests \Drupal\purge\Plugin\Purge\Queue\QueueService::release.
File
- tests/
src/ Kernel/ Queue/ ServiceTest.php, line 170
Class
Namespace
Drupal\Tests\purge\Kernel\QueueCode
public function testRelease() : void {
$this
->assertTrue(empty($this->service
->claim(10, 10)));
$this->service
->add($this->queuer, $this
->getInvalidations(4));
$claims = $this->service
->claim(4, 10);
$this
->assertTrue(empty($this->service
->claim(10, 10)));
$this->service
->release([
$claims[0],
]);
$this
->assertTrue(1 === count($this->service
->claim(4, 1)));
$this->service
->release([
$claims[1],
$claims[2],
$claims[3],
]);
$this
->assertTrue(3 === count($this->service
->claim(4, 1)));
// Assert that the claims become available again after our 1*4=4s expired.
sleep(5);
$this
->assertTrue(4 === count($this->service
->claim(10, 10)));
}