当前位置: 首页>>代码示例>>PHP>>正文


PHP InputInterface::validate方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Input\InputInterface::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP InputInterface::validate方法的具体用法?PHP InputInterface::validate怎么用?PHP InputInterface::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Input\InputInterface的用法示例。


在下文中一共展示了InputInterface::validate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_executes(InputInterface $input, OutputInterface $output, UserCommandBus $commandBus)
 {
     $input->getArgument('email')->shouldBeCalled()->willReturn('user@user.com');
     $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' => 'user@user.com', 'password' => 123456]);
     $output->writeln(sprintf('Changed password of <comment>%s</comment> %s', 'user@user.com', 'user'))->shouldBeCalled();
     $this->run($input, $output);
 }
开发者ID:BenGorUser,项目名称:UserBundle,代码行数:13,代码来源:ChangePasswordCommandSpec.php

示例2:

 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);
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:13,代码来源:ImportExchangeRateCommandSpec.php

示例3:

 function it_executes(InputInterface $input, OutputInterface $output, UserCommandBus $commandBus)
 {
     $input->getArgument('email')->shouldBeCalled()->willReturn('user@user.com');
     $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', 'user@user.com'))->shouldBeCalled();
     $this->run($input, $output);
 }
开发者ID:BenGorUser,项目名称:UserBundle,代码行数:14,代码来源:CreateUserCommandSpec.php

示例4: execute

 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);
     });
 }
开发者ID:mailsystem,项目名称:community,代码行数:15,代码来源:ContactGroupCommand.php

示例5:

 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);
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:16,代码来源:UpdateExchangeRateCommandSpec.php

示例6:

 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);
 }
开发者ID:scottbeaman,项目名称:codekata,代码行数:16,代码来源:HelloCommandSpec.php

示例7: execute

 /**
  * @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;
 }
开发者ID:codeclimate,项目名称:php-test-reporter,代码行数:23,代码来源:RollbackCommand.php

示例8: it_create_client

 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);
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:18,代码来源:CreateClientCommandSpec.php

示例9:

 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);
 }
开发者ID:dasklney,项目名称:kreta,代码行数:19,代码来源:CreateClientCommandSpec.php

示例10:

 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('kreta@kreta.com');
     $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.com', '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);
 }
开发者ID:cespedosa,项目名称:kreta,代码行数:22,代码来源:CreateUserCommandSpec.php

示例11: let

 function let(InputInterface $input)
 {
     $input->bind(Argument::cetera())->willReturn();
     $input->isInteractive()->willReturn(false);
     $input->validate()->willReturn();
 }
开发者ID:jmontoyaa,项目名称:CrowdinBundle,代码行数:6,代码来源:UploadTranslationCommandSpec.php


注:本文中的Symfony\Component\Console\Input\InputInterface::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。