/** * Set the HTTP response status code * @param int $status The HTTP response status code * @return void */ public function status($code) { $this->response->status($code); }
/** * Test can have body * * Pre-conditions: * Case A: Status code = 100 * Case B: Status code = 200 * Case C: Status code = 204 * Case D: Status code = 304 * * Post-conditions: * Case A: false * Case B: true * Case C: false * Case D: false */ public function testCanHaveBody() { $r1 = new Slim_Http_Response(new Slim_Http_Request()); //Case A $r1->status(100); $this->assertFalse($r1->canHaveBody()); //Case B $r1->status(200); $this->assertTrue($r1->canHaveBody()); //Case C $r1->status(204); $this->assertFalse($r1->canHaveBody()); //Case D $r1->status(304); $this->assertFalse($r1->canHaveBody()); }
/** * Test isServerError */ public function testIsServerError() { $r1 = new Slim_Http_Response(); $r2 = new Slim_Http_Response(); $r1->status(500); $r2->status(400); $this->assertTrue($r1->isServerError()); $this->assertFalse($r2->isServerError()); }