예제 #1
0
 /**
  * @param GenericEvent $event
  */
 public function reloadUser(GenericEvent $event)
 {
     $user = $event->getSubject();
     if (!$user instanceof UserInterface) {
         throw new UnexpectedTypeException($user, UserInterface::class);
     }
     $this->userReloader->reloadUser($user);
 }
예제 #2
0
 /**
  * @param GenericEvent $event
  */
 public function reloadUser(GenericEvent $event)
 {
     $user = $event->getSubject();
     if (!$user instanceof UserInterface) {
         throw new UnexpectedTypeException($user, 'Sylius\\Component\\User\\Model\\UserInterface');
     }
     $this->userReloader->reloadUser($user);
 }
 function it_throws_exception_when_reloading_not_a_user_interface(UserReloaderInterface $userReloader, GenericEvent $event)
 {
     $event->getSubject()->willReturn('user');
     $userReloader->reloadUser(Argument::any())->shouldNotBeCalled();
     $this->shouldThrow(new UnexpectedTypeException('user', UserInterface::class))->during('reloadUser', [$event]);
 }