refreshUser() публичный Метод

It is up to the implementation to decide if the user data should be totally reloaded (e.g. from the database), or if the UserInterface object can just be merged into some internal array of users / identity map.
public refreshUser ( Symfony\Component\Security\Core\User\UserInterface $user ) : Symfony\Component\Security\Core\User\UserInterface
$user Symfony\Component\Security\Core\User\UserInterface
Результат Symfony\Component\Security\Core\User\UserInterface
Пример #1
0
 public function testRefreshUser()
 {
     $apiUser = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\User\\User');
     $user = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\Security\\UserInterface');
     $user->expects($this->once())->method('getAPIUser')->will($this->returnValue($apiUser));
     $this->repository->expects($this->once())->method('setCurrentUser')->with($apiUser);
     $this->assertSame($user, $this->userProvider->refreshUser($user));
 }
Пример #2
0
 /**
  * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException
  */
 public function testRefreshUserNotFound()
 {
     $userId = 123;
     $apiUser = new User(array('content' => new Content(array('versionInfo' => new VersionInfo(array('contentInfo' => new ContentInfo(array('id' => $userId))))))));
     $user = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\Security\\UserInterface');
     $user->expects($this->once())->method('getAPIUser')->will($this->returnValue($apiUser));
     $this->userService->expects($this->once())->method('loadUser')->with($userId)->will($this->throwException(new NotFoundException('user', 'foo')));
     $this->userProvider->refreshUser($user);
 }