protected function UncacheableEntityAccessControlHandlerTest::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.
2 calls to UncacheableEntityAccessControlHandlerTest::buildMockUser()
- UncacheableEntityAccessControlHandlerTest::accessProvider in tests/
src/ Unit/ UncacheableEntityAccessControlHandlerTest.php - Data provider for testAccess().
- UncacheableEntityAccessControlHandlerTest::createAccessProvider in tests/
src/ Unit/ UncacheableEntityAccessControlHandlerTest.php - Data provider for testCreateAccess().
File
- tests/
src/ Unit/ UncacheableEntityAccessControlHandlerTest.php, line 245
Class
- UncacheableEntityAccessControlHandlerTest
- @coversDefaultClass \Drupal\entity\UncacheableEntityAccessControlHandler @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;
}