/** * Test get headers */ public function testGetHeaders() { $r = new Slim_Http_Response(); $headers = $r->headers(); $this->assertEquals(1, count($headers)); $this->assertEquals('text/html', $headers['Content-Type']); }
/** * Test headers * * Pre-conditions: * Case A: Set Content-Type to 'application/json' * Case B: Get non-existent header * * Post-conditions: * Case A: Header is set correctly * Case B: Returned value is NULL */ public function testResponseHeaders() { //Case A $r1 = new Slim_Http_Response(new Slim_Http_Request()); $r1->header('Content-Type', 'application/json'); $this->assertEquals('application/json', $r1->header('Content-Type')); $this->assertEquals(array('Content-Type' => 'application/json'), $r1->headers()); //Case B $this->assertNull($r1->header('foo')); }