You are here

public function ExportTest::testDelete in Acquia Content Hub 8.2

Tests deleting content.

Throws

\Drupal\Core\Entity\EntityStorageException

\Exception

See also

ContentHubExportQueue

File

tests/src/Kernel/ExportTest.php, line 555

Class

ExportTest
Tests entity exports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function testDelete() {
  $this->contentHubQueue
    ->purgeQueues();

  // Node types.
  $cdf_expectations = [];
  $this
    ->createNodeTypes($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateNodeTypeCdfObject',
  ]);

  // Nodes.
  $cdf_expectations = [];
  [
    $nid1,
    $nid2,
  ] = $this
    ->createNodes($items_expected, $cdf_expectations);

  // Node delete.
  $this
    ->deleteNodes([
    $nid1,
    $nid2,
  ], $cdf_expectations);

  // Process queue with missing entities shouldn't throw an error.
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'assertNotEmpty',
  ]);
  $this
    ->assertEquals(0, $this->contentHubQueue
    ->getQueueCount());
}