Skip to content

Instantly share code, notes, and snippets.

@felixmaier1989
Created February 24, 2016 06:52
Show Gist options
  • Save felixmaier1989/b0f94255cdd83192583f to your computer and use it in GitHub Desktop.
Save felixmaier1989/b0f94255cdd83192583f to your computer and use it in GitHub Desktop.
<?php
App::uses('CakeTestCase', 'TestSuite');
App::uses('HttpSocketResponse', 'Network/Http');
class HeaderTest extends CakeTestCase {
public function testParseHeader() {
$Response = new DebugHttpSocketResponse();
$header_string = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'header.txt');
$actual = $Response->_parseHeader($header_string);
$this->assertEquals('Wed, 24 Feb 2016 06:35:43 GMT', $actual['Date']);
$this->assertEquals('PHP/5.5.21', $actual['X-Powered-By']);
$this->assertEquals(19, $actual['X-Total-Count']);
}
}
class DebugHttpSocketResponse extends HttpSocketResponse {
public function _parseHeader($header) {
return parent::_parseHeader($header);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment