Define a context when deserializing an object from a response.
Author: Matthew Loberg (m@mloberg.com)
 public function testDeprecatedDeserializerContext()
 {
     $this->disableDeprecationWarning();
     $annotation = new DeserializationContext([]);
     $this->assertSame(DeserializationContext::NAME, $annotation->getName());
     $this->assertFalse($annotation->allowMultiple());
     $this->enableDeprecationWarning();
 }
 public function testSimple()
 {
     $annotation = new DeserializationContext(['depth' => 4, 'groups' => ['test'], 'serializeNull' => true, 'version' => 1, 'foo' => 'bar']);
     $this->assertEquals(4, $annotation->getDepth());
     $this->assertEquals(['test'], $annotation->getGroups());
     $this->assertEquals(true, $annotation->getSerializeNull());
     $this->assertEquals(1, $annotation->getVersion());
     $this->assertEquals(['foo' => 'bar'], $annotation->getAttributes());
 }
 public function testSimple()
 {
     $this->disableDeprecationWarning();
     $annotation = new DeserializationContext(['depth' => 4, 'groups' => ['test'], 'serializeNull' => true, 'version' => 1, 'foo' => 'bar']);
     $this->assertEquals(4, $annotation->getContext()['depth']);
     $this->assertEquals(['test'], $annotation->getContext()['groups']);
     $this->assertEquals(true, $annotation->getContext()['serializeNull']);
     $this->assertEquals(1, $annotation->getContext()['version']);
     $this->assertEquals('bar', $annotation->getContext()['foo']);
     $this->enableDeprecationWarning();
 }
 /**
  * Will set annotation data to $method
  *
  * @param Method                 $method
  * @param DeserializationContext $annotation
  *
  * @return null
  */
 public function handle(Method $method, $annotation)
 {
     $method->setDeserializationContext(['depth' => $annotation->getDepth(), 'groups' => $annotation->getGroups(), 'serializeNull' => $annotation->getSerializeNull(), 'version' => $annotation->getVersion(), 'attributes' => $annotation->getAttributes()]);
 }