You are here

public function ExportTest::testPublishing in Acquia Content Hub 8.2

Tests Acquia ContentHub content/configuration export.

Throws

\Exception

File

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

Class

ExportTest
Tests entity exports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

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

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

  // Nodes.
  $cdf_expectations = [];
  $this
    ->createNodes($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateNodeCdfObject',
  ]);

  // Users.
  $cdf_expectations = [];
  [
    $uid1,
  ] = $this
    ->createUsers($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateUserCdfObject',
  ]);

  // Taxonomy vocabulary.
  $cdf_expectations = [];
  $this
    ->createTaxonomyVocabulary($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateTaxonomyVocabularyCdfObject',
  ]);

  // Taxonomy terms.
  $cdf_expectations = [];
  [
    $tid1,
    $tid2,
    $tid3,
  ] = $this
    ->createTaxonomyTerms($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateTaxonomyTermCdfObject',
  ]);

  // Field storages.
  $cdf_expectations = [];
  $this
    ->createFieldStorages($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateFieldStorageCdfObject',
  ]);

  // Fields.
  $cdf_expectations = [];
  $this
    ->createFields($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateFieldCdfObject',
  ]);

  // Node with text field.
  $cdf_expectations = [];
  $nid = $this
    ->createNodeWithField($items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateNodeCdfObject',
  ]);

  // Node with entity reference field.
  $cdf_expectations = [];
  $this
    ->createNodeWithReference($tid1, $tid2, $tid3, $items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateNodeCdfObject',
  ]);

  // File.
  $cdf_expectations = [];
  $this
    ->createFile($uid1, $items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateFileCdfObject',
  ]);

  // Node update.
  $cdf_expectations = [];
  $this
    ->updateNode($nid, $items_expected, $cdf_expectations);
  $this
    ->processQueue($items_expected, $cdf_expectations, [
    $this,
    'validateNodeCdfObject',
  ]);
}