You are here

public function DisplayExtenderTest::testDisplayExtendersValidate in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayExtenderTest::testDisplayExtendersValidate()
  2. 9 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,
    ]));
  }
}