public function MenuActiveTrailTest::testGetActiveLink in Drupal 9
Same name and namespace in other branches
- 8 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 142
Class
- MenuActiveTrailTest
- Tests the active menu trail service.
Namespace
Drupal\Tests\Core\MenuCode
public function testGetActiveLink(Request $request, $links, $menu_name, $expected_link) {
$this->requestStack
->push($request);
if ($links !== FALSE) {
$this->menuLinkManager
->expects($this
->exactly(2))
->method('loadLinksbyRoute')
->with('baby_llama')
->will($this
->returnValue($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());
}