public function testApiProblemResponseBodyIsSerializedApiProblem() { $additional = ['foo' => fopen('php://memory', 'r')]; $expected = ['foo' => null, 'type' => 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html', 'title' => 'Bad Request', 'status' => 400, 'detail' => 'Random error']; $apiProblem = new ApiProblem(400, 'Random error', null, null, $additional); $response = new ApiProblemResponse($apiProblem); $this->assertEquals($expected, json_decode($response->getContent(), true)); }
public function testApiProblemResponseBodyIsSerializedApiProblem() { $apiProblem = new ApiProblem(400, 'Random error'); $response = new ApiProblemResponse($apiProblem); $this->assertEquals($apiProblem->toArray(), json_decode($response->getContent(), true)); }