public function testDeserializeAnnotation() { $serializer = new Serializer(); $json = <<<JSON { "swagger": "2.0", "paths": { "/products": { "post": { "tags": [ "products" ], "summary": "s1", "description": "d1", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "description": "data in body", "required": true, "type": "object", "x-repository": "abc" } ], "responses": { "200": { "x-repository": "def" } } } } } } JSON; $annotation = $serializer->deserialize($json, 'Swagger\\Annotations\\Swagger'); $this->assertInstanceOf('Swagger\\Annotations\\Swagger', $annotation); $this->assertJsonStringEqualsJsonString($annotation->__toString(), $this->getExpected()->__toString()); }