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');
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function detect(TokenPoolInterface $tokenPool)
 {
     $this->collator->removeAll();
     $this->visitorManager->visit($tokenPool, $this->collator);
     return new Device($this->collator->getAll());
 }