You are here

protected function ViewsEntitySchemaSubscriberIntegrationTest::assertUpdatedViews in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::assertUpdatedViews()
  2. 10 core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::assertUpdatedViews()

Checks that the passed-in view IDs were the only ones updated.

Parameters

string[] $updated_view_ids: An array of view IDs.

11 calls to ViewsEntitySchemaSubscriberIntegrationTest::assertUpdatedViews()
ViewsEntitySchemaSubscriberIntegrationTest::testBaseTableRename in core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php
Tests that renaming base tables adapts the views.
ViewsEntitySchemaSubscriberIntegrationTest::testBrokenView in core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php
Tests that broken views are handled gracefully.
ViewsEntitySchemaSubscriberIntegrationTest::testDataTableAddition in core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php
Tests that adding data tables adapts the views.
ViewsEntitySchemaSubscriberIntegrationTest::testDataTableRename in core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php
Tests that renaming data tables adapts the views.
ViewsEntitySchemaSubscriberIntegrationTest::testRevisionBaseTableRename in core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php
Tests that renaming revision tables adapts the views.

... See full list

File

core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php, line 552

Class

ViewsEntitySchemaSubscriberIntegrationTest
Tests \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber

Namespace

Drupal\Tests\views\Kernel\EventSubscriber

Code

protected function assertUpdatedViews($updated_view_ids) {
  $all_view_ids = array_keys($this->entityTypeManager
    ->getStorage('view')
    ->loadMultiple());
  $view_save_count = \Drupal::state()
    ->get('views_test_data.view_save_count', []);
  foreach ($all_view_ids as $view_id) {
    if (in_array($view_id, $updated_view_ids, TRUE)) {
      $this
        ->assertTrue(isset($view_save_count[$view_id]), "The {$view_id} view has been updated.");
    }
    else {
      $this
        ->assertFalse(isset($view_save_count[$view_id]), "The {$view_id} view has not been updated.");
    }
  }

  // Check that all test cases are updating only a subset of all the available
  // views.
  $this
    ->assertGreaterThan(count($updated_view_ids), count($all_view_ids));
}