function MenuLinkDefaultTest::testUpdateLinkWithoutPersist

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php \Drupal\Tests\Core\Menu\MenuLinkDefaultTest::testUpdateLinkWithoutPersist()
  2. 10 core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php \Drupal\Tests\Core\Menu\MenuLinkDefaultTest::testUpdateLinkWithoutPersist()
  3. 11.x core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php \Drupal\Tests\Core\Menu\MenuLinkDefaultTest::testUpdateLinkWithoutPersist()

@covers ::updateLink

File

core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultTest.php, line 42

Class

MenuLinkDefaultTest
@coversDefaultClass \Drupal\Core\Menu\MenuLinkDefault @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testUpdateLinkWithoutPersist() {
    $plugin_definition = [
        'title' => 'Hey jude',
        'enabled' => 1,
        'expanded' => 1,
        'menu_name' => 'admin',
        'parent' => '',
        'weight' => 10,
    ];
    $expected_plugin_definition = $plugin_definition;
    $expected_plugin_definition['weight'] = -10;
    $static_override = $this->prophesize(StaticMenuLinkOverridesInterface::class);
    $static_override->saveOverride()
        ->shouldNotBeCalled();
    $static_override = $static_override->reveal();
    $menu_link = new MenuLinkDefault([], 'example_menu_link', $plugin_definition, $static_override);
    $this->assertEquals($expected_plugin_definition, $menu_link->updateLink([
        'weight' => -10,
    ], FALSE));
}

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