You are here

public function NodeImportUpdateExportTest::testNodeImportUpdateExport in Acquia Content Hub 8.2

Tests Node entity create and update.

@dataProvider nodeImportUpdateExportDataProvider

Parameters

int $delta: Fixture delta.

int $update_delta: "Update" fixture delta.

array $validate_data: Data.

string $export_type: Exported entity type.

string $export_uuid: Entity UUID.

Throws

\Drupal\Core\Entity\EntityStorageException

File

tests/src/Kernel/NodeImportUpdateExportTest.php, line 91

Class

NodeImportUpdateExportTest
Tests importing and exporting nodes.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function testNodeImportUpdateExport($delta, $update_delta, array $validate_data, $export_type, $export_uuid) {
  parent::contentEntityImportExport($delta, $validate_data, $export_type, $export_uuid);
  parent::contentEntityImportExport($update_delta, $validate_data, $export_type, $export_uuid);

  /** @var \Drupal\Core\Entity\EntityRepository $repository */
  $repository = \Drupal::service('entity.repository');

  /** @var \Drupal\Node\NodeStorageInterface $node_storage */
  $node_storage = \Drupal::entityTypeManager()
    ->getStorage('node');

  /** @var \Drupal\Node\NodeInterface $node */
  $node = $repository
    ->loadEntityByUuid($export_type, $export_uuid);
  $vids = $node_storage
    ->revisionIds($node);
  $this
    ->assertEqual(count($vids), 2, "New revision created on import.");
}