function it_can_edit_user_profile(UserRepository $userRepository, EventDispatcherInterface $eventDispatcher, User $user, EditProfileAction $action)
 {
     $action->getUser()->willReturn($user);
     $action->getDisplayName()->willReturn('John Doe');
     $action->getPreferredLocale()->willReturn('fr_FR');
     $action->getEmail()->willReturn('*****@*****.**');
     $user->setName(Argument::exact(new Name('John Doe')))->willReturn($user)->shouldBeCalled();
     $user->setEmail(Argument::exact(new Email('*****@*****.**')))->willReturn($user)->shouldBeCalled();
     $user->setPreferredLocale(Argument::exact(Locale::parse('fr_Fr')))->willReturn($user)->shouldBeCalled();
     $userRepository->save($user)->shouldBeCalled();
     $this->execute($action);
 }
 public function execute(EditProfileAction $action)
 {
     $user = $action->getUser();
     $user->setName(new Name($action->getDisplayName()))->setEmail(new Email($action->getEmail()))->setPreferredLocale(Locale::parse($action->getPreferredLocale()));
     $this->userRepository->save($user);
 }