function EntityFieldManagerTest::setUpEntityTypeDefinitions
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::setUpEntityTypeDefinitions()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::setUpEntityTypeDefinitions()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::setUpEntityTypeDefinitions()
Sets up the entity type manager to be tested.
Parameters
\Drupal\Core\Entity\EntityTypeInterface[]|\Prophecy\Prophecy\ProphecyInterface[] $definitions: (optional) An array of entity type definitions.
6 calls to EntityFieldManagerTest::setUpEntityTypeDefinitions()
- EntityFieldManagerTest::setUpEntityWithFieldDefinition in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php - Prepares an entity that defines a field definition.
- EntityFieldManagerTest::testClearCachedFieldDefinitions in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php - Tests the clearCachedFieldDefinitions() method.
- EntityFieldManagerTest::testGetExtraFields in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php - @covers ::getExtraFields
- EntityFieldManagerTest::testGetFieldMap in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php - @covers ::getFieldMap
- EntityFieldManagerTest::testGetFieldMapByFieldType in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php - @covers ::getFieldMapByFieldType
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php, line 193
Class
- EntityFieldManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityFieldManager @group Entity
Namespace
Drupal\Tests\Core\EntityCode
protected function setUpEntityTypeDefinitions($definitions = []) {
foreach ($definitions as $key => $entity_type) {
// \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called
// by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must
// always be mocked.
$entity_type->getLinkTemplates()
->willReturn([]);
$definitions[$key] = $entity_type->reveal();
}
$this->entityTypeManager
->getDefinition(Argument::type('string'))
->will(function ($args) use ($definitions) {
if (isset($definitions[$args[0]])) {
return $definitions[$args[0]];
}
throw new PluginNotFoundException($args[0]);
});
$this->entityTypeManager
->getDefinition(Argument::type('string'), FALSE)
->will(function ($args) use ($definitions) {
if (isset($definitions[$args[0]])) {
return $definitions[$args[0]];
}
});
$this->entityTypeManager
->getDefinitions()
->willReturn($definitions);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.