protected function ExportTest::createFields in Acquia Content Hub 8.2
Creates fields.
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
See also
\Drupal\Tests\acquia_contenthub\Kernel\ExportTest::createFieldStorages()
\Drupal\Tests\acquia_contenthub\Kernel\ExportTest::createNodeTypes()
2 calls to ExportTest::createFields()
- 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 897
Class
- ExportTest
- Tests entity exports.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
protected function createFields(&$items_expected, array &$cdf_expectations = []) {
// Text field.
$field_definition = [
'field_name' => 'field_1',
'entity_type' => 'node',
'bundle' => 'test_content_type',
];
FieldConfig::create($field_definition)
->save();
// Entity reference field.
$field_definition = [
'field_name' => 'field_term_reference',
'entity_type' => 'node',
'bundle' => 'test_content_type',
];
FieldConfig::create($field_definition)
->save();
$items_expected = 2;
$cdf_expectations = [
[
'field_1',
[
'node',
],
'string_long',
'test_content_type',
[],
],
[
'field_term_reference',
[
'node',
'taxonomy',
],
'entity_reference',
'test_content_type',
[
'handler' => 'default:taxonomy_term',
'handler_settings' => [],
],
],
];
}