function EntityFieldManagerTest::testGetFieldStorageDefinitions
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::testGetFieldStorageDefinitions()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::testGetFieldStorageDefinitions()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::testGetFieldStorageDefinitions()
Tests the getFieldStorageDefinitions() method.
@covers ::getFieldStorageDefinitions @covers ::buildFieldStorageDefinitions
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php, line 251
Class
- EntityFieldManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityFieldManager @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetFieldStorageDefinitions() {
$field_definition = $this->setUpEntityWithFieldDefinition(TRUE);
$field_storage_definition = $this->prophesize(FieldStorageDefinitionInterface::class);
$field_storage_definition->getName()
->willReturn('field_storage');
$definitions = [
'field_storage' => $field_storage_definition->reveal(),
];
$this->moduleHandler
->getImplementations('entity_base_field_info')
->willReturn([]);
$this->moduleHandler
->getImplementations('entity_field_storage_info')
->willReturn([
'example_module',
]);
$this->moduleHandler
->invoke('example_module', 'entity_field_storage_info', [
$this->entityType,
])
->willReturn($definitions);
$this->moduleHandler
->alter('entity_field_storage_info', $definitions, $this->entityType)
->willReturn(NULL);
$expected = [
'id' => $field_definition,
'field_storage' => $field_storage_definition->reveal(),
];
$this->assertSame($expected, $this->entityFieldManager
->getFieldStorageDefinitions('test_entity_type'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.