public function DisplayCRUDTest::testAddDisplay in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php \Drupal\Tests\views_ui\Functional\DisplayCRUDTest::testAddDisplay()
Tests adding a display.
File
- core/
modules/ views_ui/ tests/ src/ Functional/ DisplayCRUDTest.php, line 36
Class
- DisplayCRUDTest
- Tests creation, retrieval, updating, and deletion of displays in the Web UI.
Namespace
Drupal\Tests\views_ui\FunctionalCode
public function testAddDisplay() {
// Show the default display.
$this
->config('views.settings')
->set('ui.show.default_display', TRUE)
->save();
$settings['page[create]'] = FALSE;
$view = $this
->randomView($settings);
$path_prefix = 'admin/structure/views/view/' . $view['id'] . '/edit';
$this
->drupalGet($path_prefix);
// Add a new display.
$this
->submitForm([], 'Add Page');
$this
->assertSession()
->linkByHrefExists($path_prefix . '/page_1', 0, 'Make sure after adding a display the new display appears in the UI');
$this
->assertSession()
->linkNotExists('Default*', 'Make sure the default display is not marked as changed.');
$this
->assertSession()
->linkExists('Page*', 0, 'Make sure the added display is marked as changed.');
$this
->drupalGet("admin/structure/views/nojs/display/{$view['id']}/page_1/path");
$this
->submitForm([
'path' => 'test/path',
], 'Apply');
$this
->submitForm([], 'Save');
}