You are here

public function ViewsEntitySchemaSubscriberIntegrationTest::testVariousTableUpdatesForRevisionView in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Tests/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\views\Tests\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::testVariousTableUpdatesForRevisionView()

Tests some possible entity table updates for a revision view.

File

core/modules/views/src/Tests/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php, line 416
Contains \Drupal\views\Tests\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest.

Class

ViewsEntitySchemaSubscriberIntegrationTest
Tests \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber

Namespace

Drupal\views\Tests\EventSubscriber

Code

public function testVariousTableUpdatesForRevisionView() {

  // base + revision <-> base + translation + revision
  $this
    ->updateEntityTypeToRevisionable();

  // Multiple changes, so we have to invalidate the caches, otherwise
  // the second update will revert the first.
  $this->entityManager
    ->clearCachedDefinitions();
  list($view, $display) = $this
    ->getUpdatedViewAndDisplay(TRUE);
  $this
    ->assertEqual('entity_test_update_revision', $view
    ->get('base_table'));
  $this
    ->assertEqual('entity_test_update_revision', $display['display_options']['fields']['id']['table']);
  $this
    ->assertEqual('entity_test_update_revision', $display['display_options']['fields']['name']['table']);
  $this
    ->updateEntityTypeToTranslatable();
  $this->entityDefinitionUpdateManager
    ->applyUpdates();
  list($view, $display) = $this
    ->getUpdatedViewAndDisplay(TRUE);
  $this
    ->assertEqual('entity_test_update_revision', $view
    ->get('base_table'));
  $this
    ->assertEqual('entity_test_update_revision', $display['display_options']['fields']['id']['table']);
  $this
    ->assertEqual('entity_test_update_revision_data', $display['display_options']['fields']['name']['table']);
  $this
    ->updateEntityTypeToNotTranslatable();
  $this->entityDefinitionUpdateManager
    ->applyUpdates();
  list($view, $display) = $this
    ->getUpdatedViewAndDisplay(TRUE);
  $this
    ->assertEqual('entity_test_update_revision', $view
    ->get('base_table'));
  $this
    ->assertEqual('entity_test_update_revision', $display['display_options']['fields']['id']['table']);
  $this
    ->assertEqual('entity_test_update_revision', $display['display_options']['fields']['name']['table']);
  $this
    ->resetEntityType();
}