function SystemMenuBlockTest::testConstructorDeprecation

@deprecationMessage The menu.active_trail service must be passed to SystemMenuBlock::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2669550. @group legacy

File

core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php, line 361

Class

SystemMenuBlockTest
Tests \Drupal\system\Plugin\Block\SystemMenuBlock.

Namespace

Drupal\Tests\system\Kernel\Block

Code

public function testConstructorDeprecation() {
  $block = new SystemMenuBlock([], 'test', [
    'provider' => 'test',
  ], $this->container
    ->get('menu.link_tree'));
  // Ensure the BC layer injects the correct object.
  $reflection_object = new \ReflectionObject($block);
  $reflection_property = $reflection_object->getProperty('menuActiveTrail');
  $reflection_property->setAccessible(TRUE);
  $this->assertSame($reflection_property->getValue($block), $this->container
    ->get('menu.active_trail'));
}

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