function DisplayExtenderTest::testDisplayExtendersValidate

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayExtenderTest::testDisplayExtendersValidate()
  2. 10 core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayExtenderTest::testDisplayExtendersValidate()
  3. 11.x core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayExtenderTest::testDisplayExtendersValidate()

Tests display extenders validation.

File

core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php, line 49

Class

DisplayExtenderTest
Tests the display extender plugins.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

public function testDisplayExtendersValidate() {
    $this->config('views.settings')
        ->set('display_extenders', [
        'display_extender_test_3',
    ])
        ->save();
    $view = Views::getView('test_view');
    $errors = $view->validate();
    foreach ($view->displayHandlers as $id => $display) {
        $this->assertArrayHasKey($id, $errors);
        $this->assertContains('Display extender test error.', $errors[$id], new FormattableMarkup('Error message found for @id display', [
            '@id' => $id,
        ]));
    }
}

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