/** * @dataProvider headerWithNoVersionsProvider */ public function testGetTransformersNamesWithNoVersions($header, $transf) { $versionParser = new VersionParser(); $request = new Request(); $request->headers->set('Accept', $header); $request->attributes->set('versions', $this->versionsDeclaration); $result = $versionParser->getTransformersNamesByVersion($request, 'Accept'); $this->assertEquals($transf, $result); }
private function prepareSerializer(Request $request, $headerName) { //if a version is specified that adds/overwrites some of the transformers, this is where it's done $overwrittenTransformers = $this->versionParser->getTransformersNamesByVersion($request, $headerName); $this->serializerFactory->overwriteTransformers($this->serializer, $overwrittenTransformers); }