function ModulePermissionsLinkHelperTest::testGetModulePermissionsLink

Same name in other branches
  1. 11.x core/modules/user/tests/src/Kernel/ModulePermissionsLinkHelperTest.php \Drupal\Tests\user\Kernel\ModulePermissionsLinkHelperTest::testGetModulePermissionsLink()

@covers ::getModulePermissionsLink

File

core/modules/user/tests/src/Kernel/ModulePermissionsLinkHelperTest.php, line 42

Class

ModulePermissionsLinkHelperTest
Tests the ModulePermissionsLinkHelper.

Namespace

Drupal\Tests\user\Kernel

Code

public function testGetModulePermissionsLink() : void {
    
    /** @var \Drupal\user\ModulePermissionsLinkHelper $permsLinkHelper */
    $permsLinkHelper = $this->container
        ->get('user.module_permissions_link_helper');
    $permsLink = $permsLinkHelper->getModulePermissionsLink('user_permissions_test', 'User permissions test');
    $this->assertNotEmpty($permsLink);
    $this->assertEquals("Configure User permissions test permissions", $permsLink['title']);
    
    /** @var \Drupal\Core\Url $url */
    $url = $permsLink['url'];
    $this->assertEquals('user.admin_permissions.module', $url->getRouteName());
    $this->assertEquals('user_permissions_test', $url->getRouteParameters()['modules']);
}

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