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); }
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); }
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'); }