function DisplayTest::testDisplayAreas

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testDisplayAreas()
  2. 8.9.x core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testDisplayAreas()
  3. 11.x core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testDisplayAreas()

Tests display areas.

File

core/modules/views_ui/tests/src/Functional/DisplayTest.php, line 133

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testDisplayAreas() : void {
    // Show the advanced column.
    $this->config('views.settings')
        ->set('ui.show.advanced_column', TRUE)
        ->save();
    // Add a new data display to the view.
    $view = Views::getView('test_display');
    $view->storage
        ->addDisplay('display_no_area_test');
    $view->save();
    $this->drupalGet('admin/structure/views/view/test_display/edit/display_no_area_test_1');
    $areas = [
        'header',
        'footer',
        'empty',
    ];
    // Assert that the expected text is found in each area category.
    foreach ($areas as $type) {
        $this->assertSession()
            ->elementTextEquals('xpath', "//div[contains(@class, '{$type}')]/div", "The selected display type does not use {$type} plugins");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.