Tests views data for entity area handlers.
public function testEntityAreaData() {
$data = $this->container
->get('views.views_data')
->get('views');
$entity_info = $this->container
->get('plugin.manager.entity')
->getDefinitions();
$expected_entities = array_filter($entity_info, function ($info) {
return !empty($info['controllers']['render']);
});
// Test that all expected entity types have data.
foreach (array_keys($expected_entities) as $entity) {
$this
->assertTrue(!empty($data['entity_' . $entity]), format_string('Views entity area data found for @entity', array(
'@entity' => $entity,
)));
// Test that entity_type is set correctly in the area data.
$this
->assertEqual($entity, $data['entity_' . $entity]['area']['entity_type'], format_string('Correct entity_type set for @entity', array(
'@entity' => $entity,
)));
}
$expected_entities = array_filter($entity_info, function ($info) {
return empty($info['controllers']['render']);
});
// Test that no configuration entity types have data.
foreach (array_keys($expected_entities) as $entity) {
$this
->assertTrue(empty($data['entity_' . $entity]), format_string('Views config entity area data not found for @entity', array(
'@entity' => $entity,
)));
}
}