function DisplayTest::testGetAttachedDisplays

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::testGetAttachedDisplays()
  2. 10 core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::testGetAttachedDisplays()
  3. 11.x core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::testGetAttachedDisplays()

Tests the getAttachedDisplays method.

File

core/modules/views/tests/src/Functional/Plugin/DisplayTest.php, line 167

Class

DisplayTest
Tests the basic display plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testGetAttachedDisplays() {
    $view = Views::getView('test_get_attach_displays');
    // Both the feed_1 and the feed_2 display are attached to the page display.
    $view->setDisplay('page_1');
    $this->assertEquals([
        'feed_1',
        'feed_2',
    ], $view->display_handler
        ->getAttachedDisplays());
    $view->setDisplay('feed_1');
    $this->assertEquals([], $view->display_handler
        ->getAttachedDisplays());
}

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