public function EntityFieldManagerTest::testGetFieldMapFromCache in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php \Drupal\Tests\Core\Entity\EntityFieldManagerTest::testGetFieldMapFromCache()
@covers ::getFieldMap
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFieldManagerTest.php, line 706 - Contains \Drupal\Tests\Core\Entity\EntityFieldManagerTest.
Class
- EntityFieldManagerTest
- @coversDefaultClass \Drupal\Core\Entity\EntityFieldManager @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetFieldMapFromCache() {
$expected = [
'test_entity_type' => [
'id' => [
'type' => 'integer',
'bundles' => [
'first_bundle' => 'first_bundle',
'second_bundle' => 'second_bundle',
],
],
'by_bundle' => [
'type' => 'string',
'bundles' => [
'second_bundle' => 'second_bundle',
],
],
],
];
$this
->setUpEntityTypeDefinitions();
$this->cacheBackend
->get('entity_field_map')
->willReturn((object) [
'data' => $expected,
]);
// Call the field map twice to make sure the static cache works.
$this
->assertEquals($expected, $this->entityFieldManager
->getFieldMap());
$this
->assertEquals($expected, $this->entityFieldManager
->getFieldMap());
}