function HandlerTest::testBrokenHandlers

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::testBrokenHandlers()
  2. 8.9.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::testBrokenHandlers()
  3. 10 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::testBrokenHandlers()

Tests broken handlers.

File

core/modules/views_ui/tests/src/Functional/HandlerTest.php, line 225

Class

HandlerTest
Tests handler UI for views.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testBrokenHandlers() : void {
    $handler_types = ViewExecutable::getHandlerTypes();
    foreach ($handler_types as $type => $type_info) {
        $this->drupalGet('admin/structure/views/view/test_view_broken/edit');
        $href = "admin/structure/views/nojs/handler/test_view_broken/default/{$type}/id_broken";
        $text = 'Broken/missing handler';
        // Test that the handler edit link is present.
        $this->assertSession()
            ->elementsCount('xpath', "//a[contains(@href, '{$href}')]", 1);
        $result = $this->assertSession()
            ->elementTextEquals('xpath', "//a[contains(@href, '{$href}')]", $text);
        $this->drupalGet($href);
        $this->assertSession()
            ->elementTextContains('xpath', '//h1', $text);
        $original_configuration = [
            'field' => 'id_broken',
            'id' => 'id_broken',
            'relationship' => 'none',
            'table' => 'views_test_data',
            'plugin_id' => 'numeric',
        ];
        foreach ($original_configuration as $key => $value) {
            $this->assertSession()
                ->pageTextContains($key . ': ' . $value);
        }
    }
}

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