protected function BundleEntityDuplicatorTest::createTextField in Entity API 8
Creates a text field on the "entity_test_with_bundle" entity.
Parameters
string $field_name: The field name.
string $bundle: The target bundle.
string $label: The field label.
3 calls to BundleEntityDuplicatorTest::createTextField()
- BundleEntityDuplicatorTest::testDuplicateDisplays in tests/
src/ Kernel/ BundleEntityDuplicatorTest.php - @covers ::duplicateDisplays
- BundleEntityDuplicatorTest::testDuplicateFields in tests/
src/ Kernel/ BundleEntityDuplicatorTest.php - @covers ::duplicateFields
- BundleEntityDuplicatorTest::testDuplicateWithFieldAndDisplays in tests/
src/ Kernel/ BundleEntityDuplicatorTest.php - @covers ::duplicate @covers ::duplicateFields @covers ::duplicateDisplays
File
- tests/
src/ Kernel/ BundleEntityDuplicatorTest.php, line 237
Class
- BundleEntityDuplicatorTest
- Tests the bundle entity duplicator.
Namespace
Drupal\Tests\entity\KernelCode
protected function createTextField($field_name, $bundle, $label) {
FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => 'entity_test_with_bundle',
'type' => 'text',
'cardinality' => 1,
])
->save();
FieldConfig::create([
'entity_type' => 'entity_test_with_bundle',
'field_name' => $field_name,
'bundle' => $bundle,
'label' => $label,
])
->save();
}