Example #1
0
 function it_should_handle_reader_events_when_converting(EventDispatcherInterface $dispatcher, ReaderInterface $reader, ElementEvent $first, ElementEvent $second)
 {
     $reader->next()->will(function ($args) use($first, $second) {
         $this->next()->will(function ($args) use($second) {
             $this->next()->will(function ($args) {
                 return false;
             });
             return $second;
         });
         return $first;
     });
     $this->convert($reader);
     $reader->next()->shouldHaveBeenCalledTimes(3);
     $dispatcher->dispatch(NakalaEvents::ELEMENT, $first)->shouldHaveBeenCalled();
     $dispatcher->dispatch(NakalaEvents::ELEMENT, $second)->shouldHaveBeenCalled();
 }
Example #2
0
 public function convert(ReaderInterface $reader)
 {
     while ($current = $reader->next()) {
         $this->dispatcher->dispatch(NakalaEvents::ELEMENT, $current);
     }
 }