public function testBodyResponse() { $this->getSlimInstance()->get('/', function () { echo "body"; }); $client = new WebTestClient($this->getSlimInstance()); $body = $client->get('/'); $this->assertSame('body', $body); }
public function testMultipleRequest() { $this->getSlimInstance()->get('/:id', function ($id) { echo "{$id}"; }); $client = new WebTestClient($this->getSlimInstance()); $client->get('/12'); $this->assertSame(200, $client->response->status()); $this->assertSame('12', $client->response->body()); $client->get('/14'); $this->assertSame(200, $client->response->status()); $this->assertSame('14', $client->response->body()); }
public function testCookieSetInRequest() { $this->getSlimInstance()->get('/', function ($req, $res) { return $res->write("body"); }); $client = new WebTestClient($this->getSlimInstance()); $key = "my_cookie"; $value = "test"; $client->setCookie($key, $value); $body = $client->get('/'); self::assertEquals($value, $client->request->getCookieParams()[$key]); }