public function EntityReferenceRelationshipTest::testEntityReferenceConfigEntity in Drupal 9
Same name and namespace in other branches
- 10 core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php \Drupal\Tests\field\Kernel\EntityReference\Views\EntityReferenceRelationshipTest::testEntityReferenceConfigEntity()
Test that config entities don't get relationships added.
File
- core/
modules/ field/ tests/ src/ Kernel/ EntityReference/ Views/ EntityReferenceRelationshipTest.php, line 355
Class
- EntityReferenceRelationshipTest
- Tests entity reference relationship data.
Namespace
Drupal\Tests\field\Kernel\EntityReference\ViewsCode
public function testEntityReferenceConfigEntity() {
// Create reference from entity_test to a config entity.
$this
->createEntityReferenceField('entity_test', 'entity_test', 'field_test_config_entity', 'field_test_config_entity', 'user_role');
Views::viewsData()
->clear();
$views_data = Views::viewsData()
->getAll();
// Test that a relationship got added for content entities but not config
// entities.
$this
->assertTrue(isset($views_data['entity_test__field_test_data']['field_test_data']['relationship']));
$this
->assertFalse(isset($views_data['entity_test__field_test_config_entity']['field_test_config_entity']['relationship']));
}