Esempio n. 1
0
 /**
  * @test
  */
 public function testConstructorCanAcceptAllMessageParts()
 {
     $body = new Stream('php://memory');
     $status = 302;
     $headers = ['location' => ['http://example.com/']];
     $response = new Response($body, $status, $headers);
     $this->assertSame($body, $response->getBody());
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertEquals($headers, $response->getHeaders());
 }
 /**
  * @param string $what
  * @param string $should
  * @param string $i
  * @param string $do
  *
  * @return Response
  * @info This Action will be called for defined route: GET /api/{what}/{should}/{i}/{do}
  * @info Example URI: GET http://localhost:8000/api/doo/whatever/you/want
  */
 public function fooAction($what, $should, $i, $do)
 {
     $response = new Response();
     $response->getBody()->write(addslashes($what) . ' ' . addslashes($should) . ' ' . addslashes($i) . ' ' . addslashes($do) . '!');
     return $response->withStatus(200, 'Thank you');
 }