Issue #2973137 by davps, efpapado, tstoeckler: EntityViewsData missed revisionable validation
parent
a7847919c4
commit
3a87d23ffa
|
|
@ -201,13 +201,15 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
|
|||
'id' => 'entity_operations',
|
||||
],
|
||||
];
|
||||
$data[$revision_table]['operations'] = [
|
||||
'field' => [
|
||||
'title' => $this->t('Operations links'),
|
||||
'help' => $this->t('Provides links to perform entity operations.'),
|
||||
'id' => 'entity_operations',
|
||||
],
|
||||
];
|
||||
if ($revision_table) {
|
||||
$data[$revision_table]['operations'] = [
|
||||
'field' => [
|
||||
'title' => $this->t('Operations links'),
|
||||
'help' => $this->t('Provides links to perform entity operations.'),
|
||||
'id' => 'entity_operations',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->entityType->hasViewBuilderClass()) {
|
||||
|
|
|
|||
|
|
@ -1009,7 +1009,36 @@ class EntityViewsDataTest extends UnitTestCase {
|
|||
public function testGetViewsDataWithEntityOperations() {
|
||||
$this->baseEntityType->setListBuilderClass('\Drupal\Core\Entity\EntityListBuilder');
|
||||
$data = $this->viewsData->getViewsData();
|
||||
$this->assertSame('entity_operations', $data[$this->baseEntityType->getBaseTable()]['operations']['field']['id']);
|
||||
|
||||
$tables = ['entity_test', 'entity_test_revision'];
|
||||
$this->assertSame($tables, array_keys($data));
|
||||
foreach ($tables as $table_name) {
|
||||
$this->assertSame('entity_operations', $data[$table_name]['operations']['field']['id']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getViewsData
|
||||
*/
|
||||
public function testGetViewsDataWithNonRevisionableEntityOperations() {
|
||||
$this->baseEntityType->setListBuilderClass('\Drupal\Core\Entity\EntityListBuilder');
|
||||
|
||||
$entity_type_without_revisions = $this->baseEntityType;
|
||||
$views_data = $this->viewsData;
|
||||
|
||||
$entity_type_keys = $entity_type_without_revisions->getKeys();
|
||||
unset($entity_type_keys['revision']);
|
||||
|
||||
$entity_type_without_revisions->set('entity_keys', $entity_type_keys);
|
||||
$views_data->setEntityType($entity_type_without_revisions);
|
||||
|
||||
$data = $views_data->getViewsData();
|
||||
|
||||
$tables = ['entity_test'];
|
||||
$this->assertSame($tables, array_keys($data));
|
||||
foreach ($tables as $table_name) {
|
||||
$this->assertSame('entity_operations', $data[$table_name]['operations']['field']['id']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue