Example #1
0
 /**
  * @dataProvider getTestData
  *
  * @param mixed      $value
  * @param string     $serialized
  * @param mixed|null $expected
  */
 public function testSerialize($value, $serialized, $expected = null)
 {
     $assert = is_object($value) ? 'assertEquals' : 'assertSame';
     if (null === $expected) {
         $expected = $value;
     }
     $this->{$assert}($serialized, $this->serializer->serialize($value));
     $this->{$assert}($expected, $this->serializer->deserialize($serialized));
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function set($key, $value, $ttl = 0)
 {
     $value = $this->serializer->serialize($value);
     return $this->driver->set($key, $value, $ttl);
 }