本文整理匯總了PHP中Drupal::ModuleHandler方法的典型用法代碼示例。如果您正苦於以下問題:PHP Drupal::ModuleHandler方法的具體用法?PHP Drupal::ModuleHandler怎麽用?PHP Drupal::ModuleHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal
的用法示例。
在下文中一共展示了Drupal::ModuleHandler方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAdministratorRole
/**
* Test assigning of permissions for the administrator role.
*/
function testAdministratorRole()
{
$this->drupalLogin($this->admin_user);
$this->drupalGet('admin/config/people/accounts');
// Verify that the administration role is none by default.
$this->assertOptionSelected('edit-user-admin-role', '', 'Administration role defaults to none.');
// Set the user's role to be the administrator role.
$edit = array();
$edit['user_admin_role'] = $this->rid;
$this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration'));
// Enable aggregator module and ensure the 'administer news feeds'
// permission is assigned by default.
\Drupal::ModuleHandler()->install(array('aggregator'));
$this->assertTrue($this->admin_user->hasPermission('administer news feeds'), 'The permission was automatically assigned to the administrator role');
}