Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / DisplayExtenderUITest.php
1 <?php
2
3 namespace Drupal\Tests\views_ui\Functional;
4
5 use Drupal\views\Views;
6
7 /**
8  * Tests the display extender UI.
9  *
10  * @group views_ui
11  */
12 class DisplayExtenderUITest extends UITestBase {
13
14   /**
15    * Views used by this test.
16    *
17    * @var array
18    */
19   public static $testViews = ['test_view'];
20
21   /**
22    * Tests the display extender UI.
23    */
24   public function testDisplayExtenderUI() {
25     $this->config('views.settings')->set('display_extenders', ['display_extender_test'])->save();
26
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';
30
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.');
33
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());
39     $view->initDisplay();
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.');
42   }
43
44 }