function LayoutBuilderEntityViewDisplayTest::testGetRuntimeSections

@covers ::getRuntimeSections
@group legacy @expectedDeprecation \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::getRuntimeSections() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext() should be used instead. See https://www.drupal.org/node/3022574.

File

core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php, line 50

Class

LayoutBuilderEntityViewDisplayTest
@coversDefaultClass \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay[[api-linebreak]]

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testGetRuntimeSections() {
  $this->container
    ->get('current_user')
    ->setAccount($this->createUser());
  $entity = EntityTest::create();
  $entity->save();
  $reflection = new \ReflectionMethod($this->sectionStorage, 'getRuntimeSections');
  $reflection->setAccessible(TRUE);
  $result = $reflection->invoke($this->sectionStorage, $entity);
  $this->assertEquals($this->sectionStorage
    ->getSections(), $result);
}

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