/**
  * Test that an event can be fetched
  */
 public function testEventCanBeFetched()
 {
     $this->storage->save(array('type' => 'event', 'sub_type' => 'conversion', 'action' => 'purchase', 'message' => 'Bob Smith just purchased a shoe', 'created' => date('Y-m-d H:i:s'), 'data' => array('foo' => 'bar')));
     $results = $this->storage->fetch(array('type' => 'event', 'sub_type' => 'conversion'));
     $this->assertTrue(1 == count($results));
     $this->assertTrue($results[0]['sub_type'] == 'conversion');
 }
Exemple #2
0
 /**
  * Log an event
  *
  * @param LoggableInterface $loggable
  * @return mixed
  */
 public function log(LoggableInterface $loggable)
 {
     if ($loggable instanceof EventCollectionInterface) {
         foreach ($loggable as $eventEntity) {
             $this->storage->save($eventEntity->toArray());
         }
     } else {
         $this->storage->save($loggable->toArray());
     }
 }
 /**
  * Test that a null event is fetched
  */
 public function testNullEventIsFetched()
 {
     $this->assertTrue(null === $this->storage->fetch(array()));
 }