function MenuLinkAddTest::testNoDeprecation

Tests deprecated plugin does not trigger deprecation unless used.

File

core/modules/menu_ui/tests/src/Kernel/MenuLinkAddTest.php, line 48

Class

MenuLinkAddTest
Tests \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd deprecation.

Namespace

Drupal\Tests\menu_ui\Kernel

Code

public function testNoDeprecation() : void {
  /** @var \Drupal\Core\Menu\LocalActionManagerInterface $local_action_manager */
  $local_action_manager = $this->container
    ->get('plugin.manager.menu.local_action');
  $instance = $local_action_manager->createInstance('entity.menu.add_link_form');
  $this->assertInstanceOf(LocalActionWithDestination::class, $instance);
  $deprecated_definition = $local_action_manager->getDefinition('entity.menu.add_link_form_deprecated');
  $this->assertSame(MenuLinkAdd::class, $deprecated_definition['class']);
}

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