function it_executes(InputInterface $input, OutputInterface $output, UserCommandBus $commandBus) { $input->getArgument('email')->shouldBeCalled()->willReturn('*****@*****.**'); $input->getArgument('password')->shouldBeCalled()->willReturn(123456); $input->hasArgument('command')->shouldBeCalled()->willReturn(true); $input->getArgument('command')->shouldBeCalled()->willReturn('command'); $input->bind(Argument::any())->shouldBeCalled(); $input->isInteractive()->shouldBeCalled()->willReturn(true); $input->validate()->shouldBeCalled(); $commandBus->handle(Argument::type(WithoutOldPasswordChangeUserPasswordCommand::class))->shouldBeCalled()->willReturn(['email' => '*****@*****.**', 'password' => 123456]); $output->writeln(sprintf('Changed password of <comment>%s</comment> %s', '*****@*****.**', 'user'))->shouldBeCalled(); $this->run($input, $output); }
function it_executes(InputInterface $input, OutputInterface $output, UserCommandBus $commandBus) { $input->getArgument('email')->shouldBeCalled()->willReturn('*****@*****.**'); $input->getArgument('password')->shouldBeCalled()->willReturn(123456); $input->getArgument('roles')->shouldBeCalled()->willReturn(['ROLE_USER', 'ROLE_ADMIN']); $input->hasArgument('command')->shouldBeCalled()->willReturn(true); $input->getArgument('command')->shouldBeCalled()->willReturn('command'); $input->bind(Argument::any())->shouldBeCalled(); $input->isInteractive()->shouldBeCalled()->willReturn(true); $input->validate()->shouldBeCalled(); $commandBus->handle(Argument::type(SignUpUserCommand::class))->shouldBeCalled(); $output->writeln(sprintf('Created %s: <comment>%s</comment>', 'user', '*****@*****.**'))->shouldBeCalled(); $this->run($input, $output); }
/** * {@inheritdoc} */ public function getUser($credentials, UserProviderInterface $userProvider) { try { $this->commandBus->handle($credentials); } catch (UserEmailInvalidException $exception) { throw new CustomUserMessageAuthenticationException('security.form_user_not_found_invalid_message'); } catch (UserInactiveException $exception) { throw new CustomUserMessageAuthenticationException('security.form_user_not_found_invalid_message'); } catch (UserDoesNotExistException $exception) { throw new CustomUserMessageAuthenticationException('security.form_user_not_found_invalid_message'); } catch (UserPasswordInvalidException $exception) { throw new CustomUserMessageAuthenticationException('security.form_invalid_credentials_invalid_message'); } return $userProvider->loadUserByUsername($credentials->email()); }
function it_does_not_get_user_because_email_is_invalid(UserProviderInterface $userProvider, UserCommandBus $commandBus, LogInUserCommand $credentials) { $commandBus->handle($credentials)->shouldBeCalled()->willThrow(UserEmailInvalidException::class); $this->shouldThrow(new CustomUserMessageAuthenticationException('security.form_user_not_found_invalid_message'))->duringGetUser($credentials, $userProvider); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->commandBus->handle(new SignUpUserCommand($input->getArgument('email'), $input->getArgument('password'), $input->getArgument('roles'))); $output->writeln(sprintf('Created %s: <comment>%s</comment>', $this->userClass, $input->getArgument('email'))); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->commandBus->handle(new WithoutOldPasswordChangeUserPasswordCommand($input->getArgument('email'), $input->getArgument('password'))); $output->writeln(sprintf('Changed password of <comment>%s</comment> %s', $input->getArgument('email'), $this->userClass)); }