Example #1
0
 /**
  * Gets an instance of a data storage adapter
  *
  * @return StorageInterface
  */
 public function getDataStorage()
 {
     if (!is_null($this->storage)) {
         return $this->storage;
     }
     // Use default data storage (cookie-based)
     $cookie = new DataStorage\Cookie();
     $cookie->setProjectToken($this->token);
     // Set data storage adapter
     $this->setDataStorage($cookie);
     // Only set user ID after data storage has been initialized
     $this->storage->setUserUuid($this->getDistinctId());
     return $this->storage;
 }
 /**
  * Test that filterState removes double-underscore-prefixed keys
  *
  * @covers Mixpanel\DataStorage\StorageAbstract::filterState
  */
 public function testFilterStateRemoveUnderscoredKeys()
 {
     $data = array('foo' => 'bar', '__alias' => 'somealias', '__mtp' => 'sure', 'distinct_id' => 'some-uuid');
     $this->assertSame(array('foo' => 'bar', 'distinct_id' => 'some-uuid'), $this->storage->filterState($data));
 }