public function ViewsEntitySchemaSubscriberIntegrationTest::testVariousTableUpdates in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\views\Tests\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::testVariousTableUpdates()
Tests a bunch possible entity definition table updates.
File
- core/
modules/ views/ src/ Tests/ EventSubscriber/ ViewsEntitySchemaSubscriberIntegrationTest.php, line 294 - Contains \Drupal\views\Tests\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest.
Class
- ViewsEntitySchemaSubscriberIntegrationTest
- Tests \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber
Namespace
Drupal\views\Tests\EventSubscriberCode
public function testVariousTableUpdates() {
// We want to test the following permutations of entity definition updates:
// base <-> base + translation
// base + translation <-> base + translation + revision
// base + revision <-> base + translation + revision
// base <-> base + revision
// base <-> base + translation + revision
// base <-> base + translation
$this
->updateEntityTypeToTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update_data', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToNotTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['name']['table']);
$this
->resetEntityType();
// base + translation <-> base + translation + revision
$this
->updateEntityTypeToTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update_data', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToRevisionable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update_data', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToNotRevisionable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update_data', $display['display_options']['fields']['name']['table']);
$this
->resetEntityType();
// base + revision <-> base + translation + revision
$this
->updateEntityTypeToRevisionable();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update_data', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToNotTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['name']['table']);
$this
->resetEntityType();
// base <-> base + revision
$this
->updateEntityTypeToRevisionable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToNotRevisionable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['name']['table']);
$this
->resetEntityType();
// base <-> base + translation + revision
$this
->updateEntityTypeToRevisionable();
$this
->updateEntityTypeToTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update_data', $display['display_options']['fields']['name']['table']);
$this
->updateEntityTypeToNotRevisionable();
$this
->updateEntityTypeToNotTranslatable();
$this->entityDefinitionUpdateManager
->applyUpdates();
list($view, $display) = $this
->getUpdatedViewAndDisplay();
$this
->assertEqual('entity_test_update', $view
->get('base_table'));
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['id']['table']);
$this
->assertEqual('entity_test_update', $display['display_options']['fields']['name']['table']);
}