function it_does_not_collect_duplicate_invalid_items(InvalidItemEvent $event, FileInvalidItem $invalidItem)
 {
     $item = ['sku' => 'sku-001', 'name_en-us' => 'Black shoes', 'name_fr-fr' => 'Chaussures noires'];
     $event->getItem()->willReturn($invalidItem);
     $invalidItem->getInvalidData()->willReturn($item);
     $hashKeyItem = md5(serialize($item));
     $this->collect($event);
     $this->getInvalidItems()->shouldReturn([$hashKeyItem => $invalidItem]);
 }
 /**
  * Collect unique invalid items
  *
  * @param InvalidItemEvent $event
  */
 public function collect(InvalidItemEvent $event)
 {
     $this->invalidItems[$this->getHashKey($event->getItem())] = $event->getItem();
 }
Ejemplo n.º 3
0
 /**
  * Log invalid item event
  *
  * @param InvalidItemEvent $event
  */
 public function invalidItem(InvalidItemEvent $event)
 {
     $this->logger->warning(sprintf('The %s was unable to handle the following item: %s (REASON: %s)', $event->getClass(), $this->formatAsString($event->getItem()->getInvalidData()), $this->translator->trans($event->getReason(), $event->getReasonParameters(), $this->translationDomain, $this->translationLocale)));
 }