You are here

public function DisplayTest::testGetAttachedDisplays in Drupal 9

Same name and namespace in other branches
  1. 8 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 164

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());
}