public function testBuildDefaultSerializer()
 {
     $transformer = $this->getMockBuilder('SoboLAN\\RestNegotiator\\Transformers\\ListTransformer')->disableOriginalConstructor()->getMock();
     $encoder = $this->getMockBuilder('Symfony\\Component\\Serializer\\Encoder\\JsonEncoder')->disableOriginalConstructor()->getMock();
     $newTransformer = $this->getMockBuilder('SoboLAN\\RestNegotiator\\Transformers\\ListTransformer')->disableOriginalConstructor()->getMock();
     $serializer = new RestSerializer(array($transformer), array($encoder));
     $serializer->replaceTransformers(array($newTransformer));
     $this->assertContains($newTransformer, $serializer->getTransformers());
 }
 public function getDeserialized($className)
 {
     $request = $this->requestStack->getCurrentRequest();
     $this->prepareSerializer($request, 'Content-Type');
     $format = $this->formatParser->getSupportedFormat($request, 'Content-Type', $this->serializer);
     //make the actual deserialization
     $data = $request->getContent();
     $deserializedData = $this->serializer->deserialize($data, $className, $format);
     $this->restoreDefaultTransformers();
     return $deserializedData;
 }