You are here

public function ServiceTest::testDelete in Purge 8.3

Tests \Drupal\purge\Plugin\Purge\Queue\QueueService::delete.

File

tests/src/Kernel/Queue/ServiceTest.php, line 188

Class

ServiceTest
Tests \Drupal\purge\Plugin\Purge\Queue\QueueService.

Namespace

Drupal\Tests\purge\Kernel\Queue

Code

public function testDelete() : void {
  $this
    ->assertTrue(empty($this->service
    ->claim(10, 10)));
  $this->service
    ->add($this->queuer, $this
    ->getInvalidations(3));
  $claims = $this->service
    ->claim(3, 1);
  $this->service
    ->delete([
    array_pop($claims),
  ]);
  sleep(4);
  $claims = $this->service
    ->claim(3, 1);
  $this
    ->assertTrue(2 === count($claims));
  $this->service
    ->delete($claims);
  sleep(4);
  $this
    ->assertTrue(empty($this->service
    ->claim(10, 10)));
}