protected function BundleEntityAccessControlHandlerTest::buildMockUser in Entity API 8
Builds a mock user.
Parameters
int $uid: The user ID.
string $permission: The permission to grant.
Return value
\Prophecy\Prophecy\ObjectProphecy The user mock.
1 call to BundleEntityAccessControlHandlerTest::buildMockUser()
- BundleEntityAccessControlHandlerTest::accessProvider in tests/
src/ Unit/ BundleEntityAccessControlHandlerTest.php - Data provider for testAccess().
File
- tests/
src/ Unit/ BundleEntityAccessControlHandlerTest.php, line 106
Class
- BundleEntityAccessControlHandlerTest
- @coversDefaultClass \Drupal\entity\BundleEntityAccessControlHandler @group entity
Namespace
Drupal\Tests\entity\UnitCode
protected function buildMockUser($uid, $permission) {
$account = $this
->prophesize(AccountInterface::class);
$account
->id()
->willReturn($uid);
$account
->hasPermission($permission)
->willReturn(TRUE);
$account
->hasPermission(Argument::any())
->willReturn(FALSE);
return $account;
}