public function it_add_customer_event(CustomerEventRepository $repository, CustomerEvent $customerEvent)
 {
     $command = new AddCustomerEventCommand();
     $command->setEvent($customerEvent->getWrappedObject());
     $repository->add($customerEvent)->shouldBeCalled();
     $this->handle($command);
 }
 /**
  * @dataProvider serializeProvider
  */
 public function testUnserialize($id, $type, $customerId, $anonymousCustomerId, $data, $time, $serialized)
 {
     $object = $this->serializer->unserialize($serialized);
     $event = new CustomerEvent($id, $type, $time);
     $event->setCustomerId($customerId);
     $event->setAnonymousCustomerId($anonymousCustomerId);
     $event->setData($data);
     $this->assertEquals($event, $object);
 }
 /**
  * @param CustomerEvent $event
  *
  * @return array
  *
  * @throws UnsupportedClassException
  */
 public function serialize($event) : array
 {
     if (!$event instanceof CustomerEvent) {
         throw new UnsupportedClassException();
     }
     return ['id' => $event->getId(), 'type' => $event->getType(), 'customerId' => $event->getCustomerId(), 'anonymousCustomerId' => $event->getAnonymousCustomerId(), 'time' => $event->getTime()->format(self::MYSQL_DATETIME_FORMAT), 'data' => json_encode($event->getData())];
 }
Пример #4
0
 public function __construct($id, DateTime $time)
 {
     parent::__construct($id, self::TYPE, $time);
 }