|
@@ 204-216 (lines=13) @@
|
| 201 |
|
/** |
| 202 |
|
* @return TokenStorage |
| 203 |
|
*/ |
| 204 |
|
private function getTokenStorageWithCurrentUser() |
| 205 |
|
{ |
| 206 |
|
$currentUser = $this->prophesize(TestUser::class); |
| 207 |
|
$currentUser->getLastLogin()->willReturn('2015.01.01'); |
| 208 |
|
|
| 209 |
|
$token = $this->prophesize(TokenInterface::class); |
| 210 |
|
$token->getUser(Argument::any())->willReturn($currentUser->reveal()); |
| 211 |
|
$token->getUsername()->willReturn('current.user'); |
| 212 |
|
$tokenStorage = $this->prophesize(TokenStorageInterface::class); |
| 213 |
|
$tokenStorage->getToken(Argument::any())->willReturn($token); |
| 214 |
|
|
| 215 |
|
return $tokenStorage; |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
/** |
| 219 |
|
* @return EntityManager |
|
@@ 221-232 (lines=12) @@
|
| 218 |
|
/** |
| 219 |
|
* @return EntityManager |
| 220 |
|
*/ |
| 221 |
|
private function getEntityManagerWithUserRepository() |
| 222 |
|
{ |
| 223 |
|
$entityManager = $this->prophesize(EntityManager::class); |
| 224 |
|
|
| 225 |
|
$userFromRepository = $this->prophesize(TestUser::class); |
| 226 |
|
$userFromRepository->getLastLogin()->willReturn('2014.01.01'); |
| 227 |
|
$repository = $this->prophesize(ObjectRepository::class); |
| 228 |
|
$repository->findOneBy(Argument::any())->willReturn($userFromRepository->reveal()); |
| 229 |
|
$entityManager->getRepository(Argument::any())->willReturn($repository->reveal()); |
| 230 |
|
|
| 231 |
|
return $entityManager; |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
|
class TestUser |
| 235 |
|
{ |