本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
});
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例11: let
function let(InputInterface $input)
{
$input->bind(Argument::cetera())->willReturn();
$input->isInteractive()->willReturn(false);
$input->validate()->willReturn();
}