You are here

public function NullifyQueueIdTest::testQueueIdNullification in Acquia Content Hub 8.2

Test "queue_id" nullification when entities loose their queued state.

File

tests/src/Kernel/NullifyQueueIdTest.php, line 192

Class

NullifyQueueIdTest
Tests the NullifyQueueId class.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function testQueueIdNullification() {

  // Get some node.
  $node = $this
    ->createNode();

  // First check whether "queue_id" exists.
  $queue_id = $this
    ->getQueueId($node
    ->id(), 'queued');
  $this
    ->assertNotEmpty($queue_id[0], 'Queue ID should not be empty');
  while ($item = $this->queue
    ->claimItem()) {
    $this->queueWorker
      ->processItem($item->data);

    // Nullification of queue_id.
    $this->publisherTracker
      ->nullifyQueueId($item->data->uuid);
  }

  // "queue_id" must be empty, when entities are in exported state.
  $queue_id = $this
    ->getQueueId($node
    ->id(), 'exported');
  $this
    ->assertEmpty($queue_id[0], 'Queue ID should be empty');
}