本文整理汇总了PHP中Prophecy\Argument::exact方法的典型用法代码示例。如果您正苦于以下问题:PHP Argument::exact方法的具体用法?PHP Argument::exact怎么用?PHP Argument::exact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prophecy\Argument
的用法示例。
在下文中一共展示了Argument::exact方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function it_handle_handlers(HandlerInterface $handler, RuleInterface $rule)
{
$configuration = array();
$this->addHandler($handler);
$handler->handle(Argument::exact($configuration), Argument::exact($rule->getWrappedObject()))->shouldBeCalled();
$this->handle($configuration, $rule);
}
示例2: createCache
/**
* @return CacheItemPoolInterface
* @throws \LogicException
*
* @link https://gist.github.com/scaytrase/3cf9c5ece4218280669c
*/
private function createCache()
{
static $items = [];
$cache = $this->prophesize(CacheItemPoolInterface::class);
$that = $this;
$cache->getItem(Argument::type('string'))->will(function ($args) use(&$items, $that) {
$key = $args[0];
if (!array_key_exists($key, $items)) {
$item = $that->prophesize(CacheItemInterface::class);
$item->getKey()->willReturn($key);
$item->isHit()->willReturn(false);
$item->get()->willReturn(null);
$item->set(Argument::any())->will(function ($args) use($item) {
$item->get()->willReturn($args[0]);
});
$item->expiresAfter(Argument::type('int'))->willReturn($item);
$item->expiresAfter(Argument::exact(null))->willReturn($item);
$item->expiresAfter(Argument::type(\DateInterval::class))->willReturn($item);
$item->expiresAt(Argument::type(\DateTimeInterface::class))->willReturn($item);
$items[$key] = $item;
}
return $items[$key]->reveal();
});
$cache->save(Argument::type(CacheItemInterface::class))->will(function ($args) use(&$items) {
$item = $args[0];
$items[$item->getKey()]->isHit()->willReturn(true);
});
return $cache->reveal();
}
示例3: testAcceptVisitorDispatchesToVisitAndPredicateMethod
public function testAcceptVisitorDispatchesToVisitAndPredicateMethod()
{
$predicate = new AndPredicate(new NullPredicate(), new NullPredicate());
$visitor = $this->prophesize(PredicateVisitor::class);
$visitor->visitAndPredicate(Argument::exact($predicate))->shouldBeCalled();
$predicate->acceptPredicateVisitor($visitor->reveal());
}
示例4:
function it_break_visiting_on_certain_status(VisitorInterface $visitor, TokenPoolInterface $tokenPool, TokenInterface $token, CollatorInterface $collector)
{
$tokenPool->getIterator()->shouldBeCalledTimes(1)->willReturn(new \ArrayIterator(array($token->getWrappedObject())));
$visitor->accept(Argument::exact($token->getWrappedObject()), Argument::exact($collector->getWrappedObject()))->shouldBeCalledTimes(1)->willReturn(true);
$visitor->visit(Argument::exact($token->getWrappedObject()), Argument::exact($collector->getWrappedObject()))->shouldBeCalledTimes(1)->willReturn(VisitorInterface::STATE_FOUND);
$this->add($visitor, -255)->shouldReturn(true);
$this->visit($tokenPool, $collector)->shouldReturn($this);
}
示例5:
function it_should_create_language(LanguageRepository $languageRepository, EventDispatcherInterface $eventDispatcher, Project $project, Language $language, CreateLanguageAction $action)
{
$action->getProject()->willReturn($project);
$action->getLocale()->willReturn('fr_FR');
$languageRepository->createNew($project, Argument::exact(Locale::parse('fr_FR')))->willReturn($language);
$languageRepository->save($language)->shouldBeCalled();
$this->execute($action)->shouldReturn($language);
}
示例6:
function it_detect_device(TokenPoolInterface $tokenPool, CollatorInterface $collator, VisitorManagerInterface $visitorManager)
{
$visitorManager->visit(Argument::exact($tokenPool->getWrappedObject()), Argument::exact($collator->getWrappedObject()))->shouldBeCalledTimes(1)->willReturn(VisitorInterface::STATE_SEEKING);
$collator->removeAll()->shouldBeCalledTimes(1);
$collator->getAll()->shouldBeCalledTimes(1)->willReturn(array());
$this->beConstructedWith($visitorManager, $collator);
$this->detect($tokenPool)->shouldReturnAnInstanceOf('DeviceDetectorIO\\DeviceDetector\\Device\\Device');
}
示例7: Definition
function it_should_create_choice_form_definition(ContainerBuilder $container)
{
$this->mockDefaultBehavior($container);
$definition = new Definition('Sylius\\ChoiceFormType');
$definition->setArguments(array('Sylius\\Model', SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, 'sylius_resource_choice'))->addTag('form.type', array('alias' => 'sylius_resource_choice'));
$container->setDefinition('sylius.form.type.resource_choice', Argument::exact($definition))->shouldBeCalled();
$this->configure(array('sylius' => array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, 'classes' => array('resource' => array('form' => array('choice' => 'Sylius\\ChoiceFormType'))))), new Configuration(), $container, AbstractResourceExtension::CONFIGURE_FORMS);
}
示例8: it_returns_all_the_modified_php_files
/**
* it returns all the modified php files
*
* @test
* @return void
*/
public function it_returns_all_the_modified_php_files(Shell $shell)
{
$mock = file_get_contents('spec/support/git.mock');
$command = Argument::exact('git status');
$shell->execute($command)->willReturn($mock);
$files = ['UserTest.php', 'User.php'];
$this->modified()->shouldReturn($files);
}
示例9: testAcceptVisitorDispatchesCallToVisitLiteralPredicateMethod
public function testAcceptVisitorDispatchesCallToVisitLiteralPredicateMethod()
{
$value = 'test value';
$predicate = new LiteralPredicate($value);
$visitor = $this->prophesize(PredicateVisitor::class);
$visitor->visitLiteralPredicate(Argument::exact($predicate))->shouldBeCalled();
$predicate->acceptPredicateVisitor($visitor->reveal());
}
示例10: Occurrences
function it_match_by_using_finder_and_analyser(FinderInterface $finder, OccurrencesAnalyserInterface $analyser, UserAgentTokenizedToken $token)
{
$iterator = new \SplObjectStorage();
$occurences = new Occurrences();
$analyser->analyse(Argument::exact($occurences))->shouldBeCalled()->willReturn($iterator);
$finder->find($token)->shouldBeCalled()->willReturn($occurences);
$this->match($token)->shouldReturn($iterator);
}
示例11:
function it_visit_token(MatcherInterface $matcher, TokenInterface $token, CollatorInterface $collator, MatcherInterface $matcher, MergingStrategyInterface $mergingStrategy, RuleInterface $rule)
{
$this->beConstructedWith($matcher, $mergingStrategy);
$rules = new \ArrayIterator(array($rule->getWrappedObject()));
$matcher->match(Argument::exact($token->getWrappedObject()))->shouldBeCalledTimes(1)->willReturn($rules);
$mergingStrategy->merge(Argument::exact($rules), Argument::exact($collator->getWrappedObject()))->shouldBeCalledTimes(1);
$this->visit($token, $collator)->shouldReturn(VisitorInterface::STATE_SEEKING);
}
示例12: let
/**
* @param \Doctrine\ORM\EntityManager $em
* @param \Symfony\Bundle\FrameworkBundle\Templating\EngineInterface $templating
* @param \Newscoop\Entity\Article $article
* @param \Newscoop\ArticlesBundle\Entity\Repository\EditorialCommentRepository $repository
*/
public function let($die, $em, $templating, $article, $repository, Registry $doctrine)
{
$doctrine->getManager()->willReturn($em);
$em->getRepository(Argument::exact('Newscoop\\ArticlesBundle\\Entity\\EditorialComment'))->willReturn($repository);
$repository->getAllByArticleNumber(Argument::any(), Argument::any())->willReturn(Argument::any());
$article->getNumber()->willReturn(1);
$this->beConstructedWith($em, $templating);
}
示例13: test_it_should_throw_an_exception_after_consecutive_failed
public function test_it_should_throw_an_exception_after_consecutive_failed()
{
$processor = $this->prophesize('Swarrot\\Processor\\ProcessorInterface');
$logger = $this->prophesize('Psr\\Log\\LoggerInterface');
$message = new Message('body', array(), 1);
$processor->process(Argument::exact($message), Argument::exact(array()))->willThrow('\\BadMethodCallException');
$processor = new ExceptionCatcherProcessor($processor->reveal(), $logger->reveal());
$this->assertNull($processor->process($message, array()));
}
示例14:
function it_return_false_of_regexp_does_not_match(UserAgentToken $token, ConditionInterface $condition, RuleInterface $rule)
{
$token->__toString()->willReturn('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.74 Safari/537.36 MRCHROME');
$condition->getValue()->willReturn('#AppleWebKitt(?:/(?P<webkit_version>\\d+[\\.\\d]+))#is');
$condition->getDynamicCapabilities()->shouldNotBeCalled()->willReturn(array('webkit_version'));
$rule->getCapabilities()->willReturn(array('applewebkit' => true))->shouldNotBeCalled();
$rule->setCapabilities(Argument::exact(array('applewebkit' => true, 'webkit_version' => '537.36')))->shouldNotBeCalled();
$this->evaluate($token, $condition, $rule)->shouldReturn(false);
}
示例15:
function it_saves_an_attribute_and_flushes_by_default($objectManager, $eventDispatcher, AttributeInterface $attribute)
{
$attribute->getCode()->willReturn('my_code');
$eventDispatcher->dispatch(Argument::exact(StorageEvents::PRE_SAVE), Argument::type('Symfony\\Component\\EventDispatcher\\GenericEvent'))->shouldBeCalled();
$objectManager->persist($attribute)->shouldBeCalled();
$objectManager->flush()->shouldBeCalled();
$eventDispatcher->dispatch(Argument::exact(StorageEvents::POST_SAVE), Argument::type('Symfony\\Component\\EventDispatcher\\GenericEvent'))->shouldBeCalled();
$this->save($attribute);
}