$entity_type_manager =
$this->
createMock('Drupal\Core\Entity\EntityTypeManagerInterface'
);
$entity_type_manager->
expects($this->
any()) ->
method('getStorage'
) ->
with($this->
equalTo('user_role'
)) ->
willReturn($role_storage);
$container =
new ContainerBuilder();
$container->
set('entity_type.manager',
$entity_type_manager);
\Drupal::
setContainer($container);
$this->users
['user_one'
] =
$this->
createUserSession(['role_one'
]);
$this->users
['user_two'
] =
$this->
createUserSession(['role_one', 'role_two'
]);
$this->users
['user_three'
] =
$this->
createUserSession(['role_two'
], TRUE
);
$this->users
['user_last'
] =
$this->
createUserSession();
} /**
* Tests the has permission method.
*
* @param string $permission
* The permission to check.
* @param \Drupal\Core\Session\AccountInterface[] $sessions_with_access
* The users with access.
* @param \Drupal\Core\Session\AccountInterface[] $sessions_without_access
* The users without access.
*
* @dataProvider providerTestHasPermission
*
* @see \Drupal\Core\Session\UserSession::hasPermission()
*/