Beispiel #1
0
 /**
  * @covers \Core\Response\Response::send
  * @runInSeparateProcess
  */
 public function testSendWithContentAsArray()
 {
     $arr = ['test1' => 'val1', 'test2' => 'val2'];
     $response = new Response($arr);
     $response->send();
     $headersList = xdebug_get_headers();
     $statusCode = http_response_code();
     $this->assertEquals(200, $statusCode);
     $this->assertContains('Connection: close', $headersList);
     $this->assertContains('Content-Type: application/json', $headersList);
     $this->assertJson(json_encode($arr), $response->getContent());
     $this->expectOutputString("{\"test1\":\"val1\",\"test2\":\"val2\"}");
 }