public function PublisherTrackerTest::testInsertOrUpdate in Acquia Content Hub 8.2
Test case to update the entity status.
@covers ::track @covers ::queue
Throws
\Drupal\Core\Entity\EntityStorageException
\Exception
File
- tests/
src/ Kernel/ PublisherTrackerTest.php, line 176
Class
- PublisherTrackerTest
- Tests publisher tracker methods.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
public function testInsertOrUpdate() {
// Status is set to queued whenever a new entity is created.
$queued_status = $this
->getTrackingTableColByUuid($this->node
->uuid(), 'status');
$this
->assertEqual($queued_status, 'queued');
// Process the queue.
while ($item = $this->queue
->claimItem()) {
$this->queueWorker
->processItem($item->data);
}
// Status changed to exported after queue process.
$exported_status = $this
->getTrackingTableColByUuid($this->node
->uuid(), 'status');
$this
->assertEqual($exported_status, 'exported');
// Change the tracking table entity status to "queued".
$this->publisherTracker
->queue($this->node);
$status_changed_to_queue = $this
->getTrackingTableColByUuid($this->node
->uuid(), 'status');
$this
->assertEqual($status_changed_to_queue, 'queued');
$hash = $this
->getTrackingTableColByUuid($this->node
->uuid(), 'hash');
// Change the tracking table entity status to "exported".
$this->publisherTracker
->track($this->node, $hash);
$status_changed_to_export = $this
->getTrackingTableColByUuid($this->node
->uuid(), 'status');
$this
->assertEqual($status_changed_to_export, 'exported');
}