function DisplayExtenderUITest::testDisplayExtenderUI
Same name in other branches
- 9 core/modules/views_ui/tests/src/Functional/DisplayExtenderUITest.php \Drupal\Tests\views_ui\Functional\DisplayExtenderUITest::testDisplayExtenderUI()
- 8.9.x core/modules/views_ui/tests/src/Functional/DisplayExtenderUITest.php \Drupal\Tests\views_ui\Functional\DisplayExtenderUITest::testDisplayExtenderUI()
- 11.x core/modules/views_ui/tests/src/Functional/DisplayExtenderUITest.php \Drupal\Tests\views_ui\Functional\DisplayExtenderUITest::testDisplayExtenderUI()
Tests the display extender UI.
File
-
core/
modules/ views_ui/ tests/ src/ Functional/ DisplayExtenderUITest.php, line 31
Class
- DisplayExtenderUITest
- Tests the display extender UI.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testDisplayExtenderUI() : void {
$this->config('views.settings')
->set('display_extenders', [
'display_extender_test',
])
->save();
$view = Views::getView('test_view');
$view_edit_url = "admin/structure/views/view/{$view->storage->id()}/edit";
$display_option_url = 'admin/structure/views/nojs/display/test_view/default/test_extender_test_option';
$this->drupalGet($view_edit_url);
$this->assertSession()
->linkByHrefExists($display_option_url, 0, 'Make sure the option defined by the test display extender appears in the UI.');
$random_text = $this->randomMachineName();
$this->drupalGet($display_option_url);
$this->submitForm([
'test_extender_test_option' => $random_text,
], 'Apply');
$this->assertSession()
->linkExists($random_text);
$this->submitForm([], 'Save');
$view = Views::getView($view->storage
->id());
$view->initDisplay();
$display_extender_options = $view->display_handler
->getOption('display_extenders');
$this->assertEquals($random_text, $display_extender_options['display_extender_test']['test_extender_test_option'], 'Make sure that the display extender option got saved.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.