Exemple #1
0
 /**
  * Persists a list of event logs represented in arrays
  * or that actually are instances of EventInterface.
  *
  * @param array $events The events to persist
  * @return void
  */
 public function persist(array $events)
 {
     $factory = new EventFactory();
     $events = array_map(function ($event) use($factory) {
         return is_array($event) ? $factory->create($events) : $event;
     }, $events);
     $this->persister()->logEvents($events);
 }
 /**
  * Tests json serializing a delete event.
  *
  * @return void
  */
 public function testJsonSerializeDelete()
 {
     $factory = new EventFactory();
     $event = new AuditDeleteEvent('123', 50, 'articles', 'authors');
     $event->setMetaInfo(['extra' => 'info']);
     $serialized = json_encode($event);
     $result = $factory->create(json_decode($serialized, true));
     $this->assertEquals($event, $result);
 }