function OverrideDisplaysTest::testRevertAllDisplays
Same name in other branches
- 8.9.x core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php \Drupal\Tests\views_ui\Functional\OverrideDisplaysTest::testRevertAllDisplays()
- 10 core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php \Drupal\Tests\views_ui\Functional\OverrideDisplaysTest::testRevertAllDisplays()
- 11.x core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php \Drupal\Tests\views_ui\Functional\OverrideDisplaysTest::testRevertAllDisplays()
Tests that the revert to all displays select-option works as expected.
File
-
core/
modules/ views_ui/ tests/ src/ Functional/ OverrideDisplaysTest.php, line 193
Class
- OverrideDisplaysTest
- Tests that displays can be correctly overridden via the user interface.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testRevertAllDisplays() {
// Create a basic view with a page, block.
// Because there is both a title on page and block we expect the title on
// the block be overridden.
$view['label'] = $this->randomMachineName(16);
$view['id'] = strtolower($this->randomMachineName(16));
$view['page[create]'] = 1;
$view['page[title]'] = $this->randomMachineName(16);
$view['page[path]'] = $this->randomMachineName(16);
$view['block[create]'] = 1;
$view['block[title]'] = $this->randomMachineName(16);
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Save and edit');
// Revert the title of the block to the default ones, but submit some new
// values to be sure that the new value is not stored.
$edit = [];
$edit['title'] = $this->randomMachineName();
$edit['override[dropdown]'] = 'default_revert';
$this->drupalGet("admin/structure/views/nojs/display/{$view['id']}/block_1/title");
$this->submitForm($edit, 'Apply');
$this->drupalGet("admin/structure/views/view/{$view['id']}/edit/block_1");
$this->submitForm([], 'Save');
$this->assertSession()
->pageTextContains($view['page[title]']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.