function StaticMenuLinkOverridesTest::testLoadMultipleOverrides

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

Tests the loadMultipleOverrides method.

@covers ::loadMultipleOverrides @covers ::getConfig

File

core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php, line 68

Class

StaticMenuLinkOverridesTest
@coversDefaultClass \Drupal\Core\Menu\StaticMenuLinkOverrides @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testLoadMultipleOverrides() : void {
    $overrides = [];
    $overrides['test1'] = [
        'parent' => 'test0',
    ];
    $overrides['test2'] = [
        'parent' => 'test1',
    ];
    $overrides['test1__la___ma'] = [
        'parent' => 'test2',
    ];
    $config_factory = $this->getConfigFactoryStub([
        'core.menu.static_menu_link_overrides' => [
            'definitions' => $overrides,
        ],
    ]);
    $static_override = new StaticMenuLinkOverrides($config_factory);
    $this->assertEquals([
        'test1' => [
            'parent' => 'test0',
        ],
        'test1.la__ma' => [
            'parent' => 'test2',
        ],
    ], $static_override->loadMultipleOverrides([
        'test1',
        'test1.la__ma',
    ]));
}

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