3 namespace Drupal\Tests\views_ui\Functional;
5 use Drupal\views\Views;
8 * Tests the display extender UI.
12 class DisplayExtenderUITest extends UITestBase {
15 * Views used by this test.
19 public static $testViews = ['test_view'];
22 * Tests the display extender UI.
24 public function testDisplayExtenderUI() {
25 $this->config('views.settings')->set('display_extenders', ['display_extender_test'])->save();
27 $view = Views::getView('test_view');
28 $view_edit_url = "admin/structure/views/view/{$view->storage->id()}/edit";
29 $display_option_url = 'admin/structure/views/nojs/display/test_view/default/test_extender_test_option';
31 $this->drupalGet($view_edit_url);
32 $this->assertLinkByHref($display_option_url, 0, 'Make sure the option defined by the test display extender appears in the UI.');
34 $random_text = $this->randomMachineName();
35 $this->drupalPostForm($display_option_url, ['test_extender_test_option' => $random_text], t('Apply'));
36 $this->assertLink($random_text);
37 $this->drupalPostForm(NULL, [], t('Save'));
38 $view = Views::getView($view->storage->id());
40 $display_extender_options = $view->display_handler->getOption('display_extenders');
41 $this->assertEqual($display_extender_options['display_extender_test']['test_extender_test_option'], $random_text, 'Make sure that the display extender option got saved.');