public function HandlerTest::testBrokenHandlers in Drupal 9
Same name and namespace in other branches
- 8 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 223
Class
- HandlerTest
- Tests handler UI for views.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testBrokenHandlers() {
$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[@class="page-title"]', $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);
}
}
}