function ModuleAdminLinksHelperTest::testGetModuleAdminLinks
Same name in other branches
- 11.x core/modules/system/tests/src/Kernel/ModuleAdminLinksHelperTest.php \Drupal\Tests\system\Kernel\ModuleAdminLinksHelperTest::testGetModuleAdminLinks()
@covers ::getModuleAdminLinks
File
-
core/
modules/ system/ tests/ src/ Kernel/ ModuleAdminLinksHelperTest.php, line 46
Class
- ModuleAdminLinksHelperTest
- Tests the ModuleAdminLinksHelper.
Namespace
Drupal\Tests\system\KernelCode
public function testGetModuleAdminLinks() : void {
// Rebuild the menu links.
$this->container
->get('plugin.manager.menu.link')
->rebuild();
$adminLinksHelper = $this->container
->get('system.module_admin_links_helper');
// Test a module that has admin links.
$links = $adminLinksHelper->getModuleAdminLinks('menu_test');
$this->assertCount(1, $links);
$this->assertEquals('menu_test.menu_name_test', $links[0]['url']->getRouteName());
// Test a module that has no admin links.
$links = $adminLinksHelper->getModuleAdminLinks('link');
$this->assertCount(0, $links);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.