public function testAccessors()
 {
     $event = new InvalidItemEvent('Foo\\Bar\\Baz', 'No special reason.', array('%param%' => 'Item1'), array('foo' => 'baz'));
     $this->assertEquals('Foo\\Bar\\Baz', $event->getClass());
     $this->assertEquals('No special reason.', $event->getReason());
     $this->assertEquals(array('%param%' => 'Item1'), $event->getReasonParameters());
     $this->assertEquals(array('foo' => 'baz'), $event->getItem());
 }
 function it_does_not_collect_duplicate_invalid_items(InvalidItemEvent $event1, InvalidItemEvent $event2)
 {
     $item = ['sku' => 'sku-001', 'name_en-us' => 'Black shoes', 'name_fr-fr' => 'Chaussures noires'];
     $hashKeyItem = md5(serialize($item));
     $event1->getItem()->willReturn($item);
     $event2->getItem()->willReturn($item);
     $this->collect($event1);
     $this->collect($event2);
     $this->getInvalidItems()->shouldReturn([$hashKeyItem => $item]);
 }
 /**
  * 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()), $this->translator->trans($event->getReason(), $event->getReasonParameters(), $this->translationDomain, $this->translationLocale)));
 }
 /**
  * Collect unique invalid items
  *
  * @param InvalidItemEvent $event
  */
 public function collect(InvalidItemEvent $event)
 {
     $this->invalidItems[$this->getHashKey($event->getItem())] = $event->getItem();
 }