You are here

public function ViewsEntitySchemaSubscriberIntegrationTest::testBrokenView in Drupal 10

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

Tests that broken views are handled gracefully.

File

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

Class

ViewsEntitySchemaSubscriberIntegrationTest
Tests \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber.

Namespace

Drupal\Tests\views\Kernel\EventSubscriber

Code

public function testBrokenView() {
  $view_id = 'test_view_entity_test';
  $this->state
    ->set('views_test_config.broken_view', $view_id);
  $this
    ->updateEntityTypeToTranslatable(TRUE);

  /** @var \Drupal\views\Entity\View $view */
  $entity_storage = $this->entityTypeManager
    ->getStorage('view');
  $view = $entity_storage
    ->load($view_id);

  // The broken handler should have been removed.
  $display = $view
    ->getDisplay('default');
  $this
    ->assertFalse(isset($display['display_options']['fields']['id_broken']));
  $this
    ->assertUpdatedViews([
    $view_id,
  ]);
}