function DisplayTest::testDisplayAreas

Same name and namespace in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testDisplayAreas()
  2. 10 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 124

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testDisplayAreas() {
    // 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) {
        $element = $this->xpath('//div[contains(@class, :class)]/div', [
            ':class' => $type,
        ]);
        $this->assertEqual($element[0]->getHtml(), new FormattableMarkup('The selected display type does not use @type plugins', [
            '@type' => $type,
        ]));
    }
}

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