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_updates_a_avaivalble_exchange_rate(ContainerInterface $container, InputInterface $input, OutputInterface $output, ImporterInterface $importer, CurrencyInterface $currency)
 {
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive()->shouldBeCalled();
     $input->validate()->shouldBeCalled();
     $output->writeln('Fetching data from external database.')->shouldBeCalled();
     $input->getArgument('importer')->shouldBeCalled()->willreturn('importer');
     $container->get('sylius.currency_importer.importer')->shouldBeCalled()->willreturn($importer);
     $importer->import()->shouldBeCalled();
     $output->writeln('Saving updated exchange rates.')->shouldBeCalled();
     $this->setContainer($container);
     $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);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $letterId = $input->getArgument('letter');
     $contactGroupId = $input->getArgument('contact-group');
     $input->validate();
     /** @var Letter $letter */
     $letter = $this->em->getRepository('MailsystemLetterBundle:Letter')->find($letterId);
     $output->writeln(sprintf('Letter : %s', $letter->getSubject()));
     /** @var ContactGroup $contactGroup */
     $contactGroup = $this->em->getRepository('OroCRMContactBundle:Group')->find($contactGroupId);
     $output->writeln(sprintf('Contact Group : %s', $contactGroup->getLabel()));
     $this->sendEmail($letter, $contactGroup, function ($data) {
         $output->writeln($data);
     });
 }
 function it_updates_all_exchange_rate(ContainerInterface $container, InputInterface $input, OutputInterface $output, EntityRepository $repository, ImporterInterface $importer, CurrencyInterface $currency)
 {
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive()->shouldBeCalled();
     $input->validate()->shouldBeCalled();
     $output->writeln('Fetching data from external database.')->shouldBeCalled();
     $input->hasOption('all')->shouldBeCalled()->willreturn(true);
     $container->get('sylius.repository.currency')->shouldBeCalled()->willreturn($repository);
     $repository->findAll()->shouldBeCalled()->willreturn(array($currency));
     $input->getArgument('importer')->shouldBeCalled()->willreturn('importer');
     $container->get('sylius.currency_importer.importer')->shouldBeCalled()->willreturn($importer);
     $importer->import(array($currency))->shouldBeCalled();
     $output->writeln('Saving updated exchange rates.')->shouldBeCalled();
     $this->setContainer($container);
     $this->run($input, $output);
 }
示例#6
0
 function it_can_output_a_message(HelloService $helloService, InputInterface $input, OutputInterface $output)
 {
     //ARRANGE
     // Some shit the Symfony Console component needs to be testable
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive(Argument::any())->shouldBeCalled();
     $input->validate(Argument::any())->shouldBeCalled();
     // Prep the service
     $helloService->getGreeting(Argument::type('\\CodeKata\\RomanNumerals\\Domain\\Name'))->willReturn('Hello, Sam');
     // Give the command an input
     $input->getArgument('name')->willReturn('Sam');
     // ASSERT
     $output->writeln('Hello, Sam')->shouldBeCalled();
     // ACT
     $this->run($input, $output);
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $input->validate();
     $logger = new ConsoleLogger($output);
     $updater = new Updater(null, false, Updater::STRATEGY_GITHUB);
     /** @var GithubStrategy $strategy */
     $strategy = $updater->getStrategy();
     $strategy->setPackageName(PharTool::PACKAGE_NAME);
     $strategy->setPharName(PharTool::PHAR_NAME);
     $strategy->setCurrentLocalVersion('@package_version@');
     if ($updater->rollback()) {
         $logger->info('Roll back successful!');
     } else {
         $logger->alert('Roll back failed.');
     }
     return 0;
 }
 public function it_create_client(ContainerInterface $container, InputInterface $input, OutputInterface $output, ClientManager $clientManager, Client $client)
 {
     $container->get('fos_oauth_server.client_manager.default')->willReturn($clientManager);
     $clientManager->createClient()->willReturn($client);
     $input->getOption('redirect-uri')->willReturn(array('redirect-uri'));
     $input->getOption('grant-type')->willReturn(array('grant-type'));
     $client->setRedirectUris(array('redirect-uri'))->shouldBeCalled();
     $client->setAllowedGrantTypes(array('grant-type'))->shouldBeCalled();
     $clientManager->updateClient($client)->shouldBeCalled();
     $client->getPublicId()->shouldBeCalled();
     $client->getSecret()->shouldBeCalled();
     $output->writeln(Argument::type('string'))->shouldBeCalled();
     $this->setContainer($container);
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive()->shouldBeCalled();
     $input->validate()->shouldBeCalled();
     $this->run($input, $output);
 }
 function it_executes(ContainerInterface $container, ClientManager $clientManager, ClientInterface $client, InputInterface $input, OutputInterface $output)
 {
     $container->get('fos_oauth_server.client_manager.default')->shouldBeCalled()->willReturn($clientManager);
     $clientManager->createClient()->shouldBeCalled()->willReturn($client);
     $input->hasArgument('command')->shouldBeCalled()->willReturn(true);
     $input->getArgument('command')->shouldBeCalled()->willReturn('command');
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive()->shouldBeCalled()->willReturn(false);
     $input->validate()->shouldBeCalled();
     $input->getOption('redirect-uri')->shouldBeCalled()->willReturn(['the-redirect-uri']);
     $client->setRedirectUris(['the-redirect-uri'])->shouldBeCalled();
     $input->getOption('grant-type')->shouldBeCalled()->willReturn(['the-grant-type']);
     $client->setAllowedGrantTypes(['the-grant-type'])->shouldBeCalled();
     $clientManager->updateClient($client)->shouldBeCalled();
     $client->getPublicId()->shouldBeCalled()->willReturn('public-id');
     $client->getSecret()->shouldBeCalled()->willReturn('secret');
     $output->writeln(sprintf('A new client with public id <info>%s</info>, secret <info>%s</info> has been added', 'public-id', 'secret'))->shouldBeCalled();
     $this->run($input, $output);
 }
示例#10
0
 function it_executes(ContainerInterface $container, UserFactory $userFactory, UserInterface $user, UserManager $userManager, InputInterface $input, OutputInterface $output)
 {
     $container->get('kreta_user.factory.user')->shouldBeCalled()->willReturn($userFactory);
     $input->bind(Argument::any())->shouldBeCalled();
     $input->isInteractive()->shouldBeCalled()->willReturn(true);
     $input->validate()->shouldBeCalled();
     $input->hasArgument('command')->shouldBeCalled()->willReturn(true);
     $input->getArgument('command')->shouldBeCalled()->willReturn('command');
     $input->getArgument('email')->shouldBeCalled()->willReturn('*****@*****.**');
     $input->getArgument('username')->shouldBeCalled()->willReturn('kreta');
     $input->getArgument('firstName')->shouldBeCalled()->willReturn('Kreta');
     $input->getArgument('lastName')->shouldBeCalled()->willReturn('User');
     $input->getArgument('password')->shouldBeCalled()->willReturn('123456');
     $userFactory->create('*****@*****.**', 'kreta', 'Kreta', 'User', true)->shouldBeCalled()->willReturn($user);
     $user->setPlainPassword('123456')->shouldBeCalled()->willReturn($user);
     $container->get('fos_user.user_manager')->shouldBeCalled()->willReturn($userManager);
     $userManager->updatePassword($user)->shouldBeCalled();
     $userManager->updateUser($user)->shouldBeCalled()->willReturn($user);
     $user->getUsername()->shouldBeCalled()->willReturn('kreta');
     $output->writeln(sprintf('A new <info>%s</info> user has been created', 'kreta'))->shouldBeCalled();
     $this->run($input, $output);
 }
 function let(InputInterface $input)
 {
     $input->bind(Argument::cetera())->willReturn();
     $input->isInteractive()->willReturn(false);
     $input->validate()->willReturn();
 }