public function ExportTest::testQueue in Acquia Content Hub 8.2
Tests Acquia ContentHub export queue.
Throws
\Drupal\Core\Entity\EntityStorageException
See also
ContentHubExportQueue
File
- tests/
src/ Kernel/ ExportTest.php, line 271
Class
- ExportTest
- Tests entity exports.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
public function testQueue() {
// Initial queue state and "purge" operation.
$expected = 0;
// There may or may not be items in queue,
// so asserting queue count >= 0 makes more sense.
$this
->assertTrue($this->contentHubQueue
->getQueueCount() >= $expected);
$this->contentHubQueue
->purgeQueues();
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Node types.
$this
->createNodeTypes($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Nodes.
[
$nid1,
$nid2,
] = $this
->createNodes($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Users.
[
$uid1,
] = $this
->createUsers($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Taxonomy vocabulary.
$this
->createTaxonomyVocabulary($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Taxonomy terms.
[
$tid1,
$tid2,
$tid3,
] = $this
->createTaxonomyTerms($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Field storages.
$this
->createFieldStorages($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Fields.
$this
->createFields($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Node with custom field.
$nid3 = $this
->createNodeWithField($items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Node with entity reference.
$nid4 = $this
->createNodeWithReference($tid1, $tid2, $tid3, $items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// File entity.
$this
->createFile($uid1, $items_expected);
$expected += $items_expected;
$this
->assertEquals($expected, $this->contentHubQueue
->getQueueCount());
// Purge queue.
$this->contentHubQueue
->purgeQueues();
$this
->assertEquals(0, $this->contentHubQueue
->getQueueCount());
// Node update.
$this
->updateNode($nid3, $items_expected);
$this
->assertEquals($items_expected, $this->contentHubQueue
->getQueueCount());
// Purge queue.
$this->contentHubQueue
->purgeQueues();
$this
->assertEquals(0, $this->contentHubQueue
->getQueueCount());
// Node delete.
$this
->deleteNodes([
$nid1,
$nid2,
$nid3,
$nid4,
]);
$this
->assertEquals(0, $this->contentHubQueue
->getQueueCount());
}