public function testFormatDataResponseJSON() { $expectedHeaders = array('test' => 'something', 'Cache-Control' => 'no-cache, must-revalidate'); $response = $this->controller->customDataResponse(array('hi')); $response = $this->controller->buildResponse($response, 'json'); $this->assertEquals(array('hi'), $response->getData()); $this->assertEquals(300, $response->getStatus()); $this->assertEquals($expectedHeaders, $response->getHeaders()); }
public function testFormatDataResponseJSON() { $expectedHeaders = ['test' => 'something', 'Cache-Control' => 'no-cache, must-revalidate', 'Content-Type' => 'application/json; charset=utf-8', 'Content-Security-Policy' => "default-src 'none';script-src 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self';connect-src 'self';media-src 'self'"]; $response = $this->controller->customDataResponse(array('hi')); $response = $this->controller->buildResponse($response, 'json'); $this->assertEquals(array('hi'), $response->getData()); $this->assertEquals(300, $response->getStatus()); $this->assertEquals($expectedHeaders, $response->getHeaders()); }