Can someone tell me why assertHeader and assertHeaderContains fail for me? Everything else works fine.
I have a response object that explicitly returns valid data (see below). I run some basic test control units against this answer, all of which work, except for "assertHeader" and "assertHeaderContains".
Here's a dump of my Zend_Http_Response, without a body. This response is returned by the controller method (client / read):
.object(Zend_Http_Response)#182 (5) {
["version":protected]=>
string(3) "1.1"
["code":protected]=>
int(200)
["message":protected]=>
string(2) "OK"
["headers":protected]=>
array(8) {
["Connection"]=>
string(5) "close"
["Date"]=>
string(29) "Thu, 27 Jan 2011 14:30:07 GMT"
["Server"]=>
string(17) "Microsoft-IIS/6.0"
["X-powered-by"]=>
string(7) "ASP.NET"
["X-aspnet-version"]=>
string(9) "2.0.50727"
["Cache-control"]=>
string(7) "private"
["Content-type"]=>
string(8) "text/xml"
["Content-length"]=>
string(4) "2075"
}
["body":protected]=>
Here are my unit tests:
public function testCustomerRead(){
$this->dispatch('customer/read');
$this->assertResponsecode(200);
$this->assertController('customer');
$this->assertAction('read');
$this->assertHeader('Content-type');
**
$this->assertHeaderContains('Content-type', 'text/xml');
}
source
share