/**
  * @param array $payload
  *
  * @return MessageDeliveryEvent
  */
 public static function createMessageDeliveryEvent(array $payload)
 {
     $delivery = Delivery::create($payload['delivery']);
     $senderId = $payload['sender']['id'];
     $recipientId = $payload['recipient']['id'];
     return new MessageDeliveryEvent($senderId, $recipientId, $delivery);
 }
 function it_create_a_message_delivery_event()
 {
     $raw = '
         {
            "sender":{
               "id":"USER_ID"
            },
            "recipient":{
               "id":"PAGE_ID"
            },
            "delivery":{
               "mids":[
                  "mid.1458668856218:ed81099e15d3f4f233"
               ],
               "watermark":1458668856253,
               "seq":37
            }
         }    
     ';
     $arr = json_decode($raw, true);
     $expectedEvent = new MessageDeliveryEvent('USER_ID', 'PAGE_ID', Delivery::create($arr['delivery']));
     $event = $this::createMessageDeliveryEvent($arr);
     $event->shouldBeLike($expectedEvent);
     $event2 = $this::create($arr);
     $event2->shouldBeLike($expectedEvent);
 }