本文整理汇总了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');
}