本文整理汇总了PHP中Prophecy\Argument::containingString方法的典型用法代码示例。如果您正苦于以下问题:PHP Argument::containingString方法的具体用法?PHP Argument::containingString怎么用?PHP Argument::containingString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prophecy\Argument
的用法示例。
在下文中一共展示了Argument::containingString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_should_show_prompt(Application $application, OutputInterface $output, OutputFormatterInterface $outputFormatter)
{
$application->getName()->willReturn('some')->shouldBeCalled();
$outputFormatter->format(Argument::containingString('some'))->shouldBeCalled()->willReturn('prompt');
$output->write('prompt')->shouldBeCalled();
$this->showPrompt();
}
示例2: testOnKernelRequestRelevantRequest
public function testOnKernelRequestRelevantRequest()
{
$headerBag = $this->prophesize('Symfony\\Component\\HttpFoundation\\HeaderBag');
$headerBag->get('Content-type', null)->willReturn('application/pgp-encrypted')->shouldBeCalled();
$headerBag = $headerBag->reveal();
$parameterBag = $this->prophesize('Symfony\\Component\\HttpFoundation\\ParameterBag');
$parameterBag->set(Argument::containingString('decrypted'), Argument::type('string'))->shouldBeCalled();
$parameterBag->set(Argument::containingString('signature'), Argument::any())->shouldBeCalled();
$parameterBag = $parameterBag->reveal();
$request = $this->prophesize('Symfony\\Component\\HttpFoundation\\Request');
$request->getContent()->willReturn('foo')->shouldBeCalled();
$request->headers = $headerBag;
$request->request = $parameterBag;
$request = $request->reveal();
$args = $this->prophesize('Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent');
$args->isMasterRequest()->willReturn(true);
$args->getRequest()->willReturn($request);
$args = $args->reveal();
$decrypter = $this->prophesize();
$decrypter->willImplement('Alameda\\Bundle\\EncryptionBundle\\Encryption\\DecrypterInterface');
$decrypter->willImplement('Alameda\\Bundle\\EncryptionBundle\\Encryption\\AuthorizedSignatureInterface');
$decrypter->decrypt(Argument::type('string'))->willReturn('foo');
$decrypter->getSignature()->willReturn('bar');
$decrypter = $decrypter->reveal();
$subscriber = new DecryptSubscriber($decrypter);
$subscriber->onKernelRequest($args);
}
示例3:
public function test createKeyPair will notice the logger()
{
$dummyKeyPair = $this->prophesize(KeyPair::class)->reveal();
$this->mockLogger->info(Argument::containingString('Generating new KeyPair'), Argument::any())->shouldBeCalled();
$this->mockManager->generateKeyPair()->shouldBeCalled()->willReturn($dummyKeyPair);
$this->mockStorage->store($dummyKeyPair)->shouldBeCalled();
$this->service->createKeyPair();
}
示例4: addLikeCriteriaSpec
protected function addLikeCriteriaSpec(Collaborator $queryBuilder, Collaborator $expr, array $values, Collaborator $comparison)
{
$queryBuilder->expr()->shouldBeCalled()->willReturn($expr);
$expr->like($this->getPropertyNameSpec(key($values)), Argument::containingString(':likeValue'))->shouldBeCalled()->willReturn($comparison);
$queryBuilder->andWhere($comparison)->shouldBeCalled()->willReturn($queryBuilder);
$queryBuilder->setParameter(Argument::containingString('likeValue'), '%' . $values[key($values)] . '%')->shouldBeCalled()->willReturn($queryBuilder);
return $queryBuilder;
}
示例5: fputs
function it_shows_message_when_pause_is_called(OutputInterface $output)
{
fputs($this->inputStream, "Y\n");
rewind($this->inputStream);
$this->activate();
$this->pause('step name');
$output->write(Argument::containingString('step name'))->shouldHaveBeenCalled();
}
示例6: testThrowExceptionIfQueueDoesNotExist
public function testThrowExceptionIfQueueDoesNotExist()
{
$input = $this->prophesize(InputInterface::class);
$output = $this->prophesize(OutputInterface::class);
$input->getOption('queue')->shouldBeCalled()->willReturn('default');
$this->sqsClient->getQueueUrl(['QueueName' => 'default'])->shouldBeCalled()->willThrow(SqsException::class);
$output->writeln(Argument::containingString('<error>Impossible to retrieve URL for queue "default"'))->shouldBeCalled();
$this->executeCommand($input, $output);
}
示例7: testLogError
/**
* It should log exceptions as ERROR.
*/
public function testLogError()
{
$this->iterations->hasException()->willReturn(true);
$this->iterations->getSubject()->willReturn($this->subject->reveal());
$this->subject->getName()->willReturn('benchFoo');
$this->output->write(Argument::containingString('ERROR'))->shouldBeCalled();
$this->output->write(PHP_EOL)->shouldBeCalled();
$this->logger->iterationsEnd($this->iterations->reveal());
}
示例8:
function it_should_setup_container(Container $container, EventDispatcherInterface $dispatcher)
{
$container->setShared(Argument::any(), Argument::any())->shouldBeCalled();
$container->set('phpguard', Argument::any())->shouldBeCalled();
$container->get('dispatcher')->shouldBeCalled()->willReturn($dispatcher);
$container->set('ui.application', $this)->shouldBeCalled();
$container->setShared('ui.shell', Argument::any())->shouldBeCalled();
$container->setShared(Argument::containingString('listeners'), Argument::any())->shouldBeCalled();
$this->setupContainer($container);
}
示例9:
public function test register will notice the logger()
{
$dummyKeyPair = $this->prophesize(KeyPair::class)->reveal();
$mockClient = $this->prophesize(AcmeClient::class);
$mockClient->registerAccount($this->dummyContactEmail)->shouldBeCalled();
$mockLogger = $this->prophesize(LoggerInterface::class);
$this->service->setLogger($mockLogger->reveal());
$mockLogger->notice(Argument::containingString('Account {contactEmail} registered'), ['contactEmail' => $this->dummyContactEmail])->shouldBeCalled();
$this->mockClientFactory->createAcmeClient($dummyKeyPair)->shouldBeCalled()->willReturn($mockClient->reveal());
$this->service->register($dummyKeyPair);
}
示例10: testWrap
/**
* It should allow the PHP executable to be wrapped with a different executable.
*/
public function testWrap()
{
$process = $this->prophesize('Symfony\\Component\\Process\\Process');
$payload = new Payload(__DIR__ . '/template/foo.template', array(), $process->reveal());
$payload->setWrapper('bockfire');
$payload->setPhpPath('/boo/bar/php');
$process->setCommandLine(Argument::containingString('bockfire /boo/bar/php'))->shouldBeCalled();
$process->run()->shouldBeCalled();
$process->isSuccessful()->willReturn(true);
$process->getOutput()->willReturn('{"foo": "bar"}');
$payload->launch($payload);
}
示例11: testUseSubjectTimeUnit
/**
* It should use the subject time unit.
*/
public function testUseSubjectTimeUnit()
{
$this->iterations->getRejectCount()->willReturn(0);
$this->iterations->getStats()->willReturn(array('mean' => 1.0, 'stdev' => 2.0, 'rstdev' => 20.0));
$this->iterations->getSubject()->willReturn($this->subject->reveal());
$this->iterations->getParameterSet()->willReturn($this->parameterSet->reveal());
$this->subject->getOutputTimeUnit()->willReturn(TimeUnit::MICROSECONDS);
$this->subject->getName()->willReturn('benchFoo');
$this->parameterSet->getIndex()->willReturn(0);
$this->output->writeln(Argument::containingString('1.000μs'))->shouldBeCalled();
$this->logger->iterationsEnd($this->iterations->reveal());
}
示例12: find_all_will_return_an_array_of_segments
/**
* @test
*/
public function find_all_will_return_an_array_of_segments()
{
$client = $this->prophesize(Auth::class);
$repository = new SegmentBillingRepository($client->reveal());
$fakeResponse = $this->getFakeResponse($this->getMultipleBillingSegments());
$client->request('GET', Argument::containingString('start_element=3'))->willReturn($fakeResponse)->shouldBeCalled();
$segments = $repository->findAll('member_id', 3, 3);
$this->assertNotEmpty($segments);
foreach ($segments as $segment) {
$this->assertInstanceOf(SegmentBilling::class, $segment);
}
}
示例13: preConsume_should_log_debug_message
/**
* @test
*/
public function preConsume_should_log_debug_message()
{
$body = 'payload-body';
$messageName = 'message-name';
$methodName = 'MyClass::myMethod';
/** @var ConsumerContainer $consumerContainer */
$consumerContainer = $this->prophesize(ConsumerContainer::class);
$consumerContainer->getRoutingKey()->willReturn($messageName);
$consumerContainer->getMethodName()->willReturn($methodName);
$event = new ConsumerEvent(new AMQPMessage($body), $consumerContainer->reveal());
$this->subscriber->preConsume($event);
$this->logger->debug(Argument::allOf(Argument::containingString($messageName), Argument::containingString($methodName), Argument::containingString($body)))->shouldHaveBeenCalled();
}
示例14: ProcessEvent
function it_should_handle_runAllCommand_events(GenericEvent $event, ContainerInterface $container, PluginInterface $plugin, Logger $logger)
{
$event->getSubject()->willReturn($container);
$event->addProcessEvent(Argument::any())->shouldBeCalled();
$logger->addDebug(Argument::cetera())->shouldBeCalled();
$logger->addDebug(Argument::containingString('Start'))->shouldBeCalled();
$logger->addDebug(Argument::containingString('End'), Argument::cetera())->shouldBeCalled();
$event->getArgument('plugin')->willReturn(null);
$resultEvent = new ProcessEvent($plugin->getWrappedObject(), array());
$plugin->getTitle()->willReturn('PluginSpec');
$plugin->runAll()->shouldBeCalled()->willReturn($resultEvent);
$this->runAllCommand($event);
}
示例15: handle_should_log_message_with_payload
/**
* @test
*/
public function handle_should_log_message_with_payload()
{
$exceptionMessage = "Fatal error";
$baseException = new Exception($exceptionMessage);
$payloadMessage = $this->prophesize(MessageInterface::class);
$exception = new ConsumerContainerException($this->consumerContainer->reveal(), new AMQPMessage(), $payloadMessage->reveal(), $baseException);
$this->handler->handle($exception);
$this->logger->warning(Argument::allOf(Argument::containingString(self::MESSAGE_CLASS), Argument::containingString($exceptionMessage)), Argument::that(function ($context) use($baseException) {
verify($context['exception'])->isInstanceOf(ConsumerContainerException::class);
verify($context['exception']->getPrevious())->equals($baseException);
return $context;
}))->shouldHaveBeenCalled();
}