function MenuActiveTrailTest::testGetActiveLink
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php \Drupal\Tests\Core\Menu\MenuActiveTrailTest::testGetActiveLink()
- 8.9.x core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php \Drupal\Tests\Core\Menu\MenuActiveTrailTest::testGetActiveLink()
- 10 core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php \Drupal\Tests\Core\Menu\MenuActiveTrailTest::testGetActiveLink()
Tests getActiveLink().
@covers ::getActiveLink @dataProvider provider
File
-
core/
tests/ Drupal/ Tests/ Core/ Menu/ MenuActiveTrailTest.php, line 145
Class
- MenuActiveTrailTest
- Tests the active menu trail service.
Namespace
Drupal\Tests\Core\MenuCode
public function testGetActiveLink(Request $request, $links, $menu_name, $expected_link) : void {
$this->requestStack
->push($request);
if ($links !== FALSE) {
$this->menuLinkManager
->expects($this->exactly(2))
->method('loadLinksByRoute')
->with('baby_llama')
->willReturn($links);
}
// Test with menu name.
$this->assertSame($expected_link, $this->menuActiveTrail
->getActiveLink($menu_name));
// Test without menu name.
$this->assertSame($expected_link, $this->menuActiveTrail
->getActiveLink());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.