IsAlreadyEnqueuedTest.php in Acquia Content Hub 8.2
File
tests/src/Kernel/IsAlreadyEnqueuedTest.php
View source
<?php
namespace Drupal\Tests\acquia_contenthub\Kernel;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
class IsAlreadyEnqueuedTest extends QueueingTestBase {
public static $modules = [
'node',
'user',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('node');
$this
->installEntitySchema('user');
$this
->installSchema('node', [
'node_access',
]);
NodeType::create([
'type' => 'bundle_test',
])
->save();
}
public function testIsAlreadyEnqueued() {
$this->contentHubQueue
->purgeQueues();
$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.');
}
}