function ViewsEntitySchemaSubscriberIntegrationTest::testBrokenView

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::testBrokenView()
  2. 10 core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php \Drupal\Tests\views\Kernel\EventSubscriber\ViewsEntitySchemaSubscriberIntegrationTest::testBrokenView()
  3. 11.x 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 512

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,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.