public function IsAlreadyEnqueuedTest::testIsAlreadyEnqueued in Acquia Content Hub 8.2
Tests that node isn't enqueued more than once.
File
- tests/
src/ Kernel/ IsAlreadyEnqueuedTest.php, line 47
Class
- IsAlreadyEnqueuedTest
- Tests that entities aren't added to the queue multiple times.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
public function testIsAlreadyEnqueued() {
// Makes sure queue is empty before this test.
$this->contentHubQueue
->purgeQueues();
// Creates a new published node.
/** @var \Drupal\node\NodeInterface $node */
$node = Node::create([
'type' => 'bundle_test',
'title' => 'Title',
]);
$node
->setPublished();
$node
->save();
$this
->assertEquals($this->contentHubQueue
->getQueueCount(), 1, 'Node created and queued.');
$node
->setTitle('New title');
$node
->save();
$this
->assertEquals($this->contentHubQueue
->getQueueCount(), 1, 'Node not queued again.');
}