function FieldDefinitionTest::initializeFieldUsingFactory
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php \Drupal\Tests\Core\Entity\FieldDefinitionTest::initializeFieldUsingFactory()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php \Drupal\Tests\Core\Entity\FieldDefinitionTest::initializeFieldUsingFactory()
- 10 core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php \Drupal\Tests\Core\Entity\FieldDefinitionTest::initializeFieldUsingFactory()
Creates a bundle field using a specified factory.
Parameters
string $factory_name: The factory name to use.
Return value
\Drupal\Core\Field\FieldDefinition
14 calls to FieldDefinitionTest::initializeFieldUsingFactory()
- FieldDefinitionTest::testBundle in core/
tests/ Drupal/ Tests/ Core/ Entity/ FieldDefinitionTest.php - @covers ::setTargetBundle @covers ::getTargetBundle @dataProvider factoryTypeProvider
- FieldDefinitionTest::testDefaultFieldSettings in core/
tests/ Drupal/ Tests/ Core/ Entity/ FieldDefinitionTest.php - @covers ::getSetting @covers ::setSetting @covers ::getSettings @dataProvider factoryTypeProvider
- FieldDefinitionTest::testDefaultValueCallback in core/
tests/ Drupal/ Tests/ Core/ Entity/ FieldDefinitionTest.php - Tests default value callbacks.
- FieldDefinitionTest::testDisplayConfigurationSettings in core/
tests/ Drupal/ Tests/ Core/ Entity/ FieldDefinitionTest.php - Tests the display configuration settings.
- FieldDefinitionTest::testFieldDefaultValue in core/
tests/ Drupal/ Tests/ Core/ Entity/ FieldDefinitionTest.php - @covers ::getDefaultValue @covers ::setDefaultValue @dataProvider factoryTypeProvider
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ FieldDefinitionTest.php, line 372
Class
- FieldDefinitionTest
- Unit test for the FieldDefinition class.
Namespace
Drupal\Tests\Core\EntityCode
protected function initializeFieldUsingFactory($factory_name) {
switch ($factory_name) {
case 'createFromFieldStorageDefinition':
return FieldDefinition::createFromFieldStorageDefinition($this->storageDefinition);
case 'create':
$definition = FieldDefinition::create($this->fieldType);
$definition->setFieldStorageDefinition($this->storageDefinition);
return $definition;
case 'createFromDataType':
$definition = FieldDefinition::createFromDataType($this->fieldType);
$definition->setFieldStorageDefinition($this->storageDefinition);
return $definition;
case 'createFromItemType':
$definition = FieldDefinition::createFromItemType($this->fieldType);
$definition->setFieldStorageDefinition($this->storageDefinition);
return $definition;
}
throw new \InvalidArgumentException("Invalid factory name '{$factory_name}' passed to " . __METHOD__);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.