You are here

protected function ExportTest::createFieldStorages in Acquia Content Hub 8.2

Creates field storages.

Parameters

int $items_expected: Expected number of items in the queue.

array $cdf_expectations: The sets of expectation arguments for CDF object validation.

Throws

\Drupal\Core\Entity\EntityStorageException

2 calls to ExportTest::createFieldStorages()
ExportTest::testPublishing in tests/src/Kernel/ExportTest.php
Tests Acquia ContentHub content/configuration export.
ExportTest::testQueue in tests/src/Kernel/ExportTest.php
Tests Acquia ContentHub export queue.

File

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

Class

ExportTest
Tests entity exports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function createFieldStorages(&$items_expected, array &$cdf_expectations = []) {

  // Text field.
  $field_storage_definition1 = [
    'field_name' => 'field_1',
    'type' => 'string_long',
    'entity_type' => 'node',
  ];
  $field_storage1 = FieldStorageConfig::create($field_storage_definition1);
  $field_storage1
    ->save();
  $this->fieldUuids[] = $field_storage1
    ->uuid();

  // Entity reference field.
  $field_storage_definition2 = [
    'entity_type' => 'node',
    'field_name' => 'field_term_reference',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'taxonomy_term',
    ],
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ];
  $field_storage2 = FieldStorageConfig::create($field_storage_definition2);
  $field_storage2
    ->save();
  $this->fieldUuids[] = $field_storage2
    ->uuid();
  $items_expected = 2;
  $cdf_expectations = [
    [
      'field_1',
      'string_long',
      [
        'node',
      ],
      [
        'case_sensitive' => FALSE,
      ],
      1,
    ],
    [
      'field_term_reference',
      'entity_reference',
      [
        'node',
        'taxonomy',
      ],
      [
        'target_type' => 'taxonomy_term',
      ],
      FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
    ],
  ];
}