Skip to content

Commit

Permalink
Adding test method for CakeResponse::download()
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 2, 2010
1 parent cb63cd1 commit 8968204
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cake/tests/cases/libs/cake_response.test.php
Expand Up @@ -86,7 +86,7 @@ public function testType() {

$response->type(array('keynote' => 'application/keynote'));
$this->assertEquals($response->type('keynote'), 'application/keynote');

$this->assertFalse($response->type('wackytype'));
}

Expand Down Expand Up @@ -289,7 +289,7 @@ public function testCompress() {
* Tests the httpCodes method
*
*/
function testHttpCodes() {
public function testHttpCodes() {
$response = new CakeResponse();
$result = $response->httpCodes();
$this->assertEqual(count($result), 39);
Expand Down Expand Up @@ -320,4 +320,18 @@ function testHttpCodes() {
$expected = array(404 => 'Sorry Bro');
$this->assertEqual($result, $expected);
}

/**
* Tests the download method
*
*/
public function testDownload() {
$response = new CakeResponse();
$expected = array(
'Content-Disposition' => 'attachment; filename="myfile.mp3"'
);
$response->download('myfile.mp3');
$this->assertEquals($response->header(), $expected);
}

}

0 comments on commit 8968204

Please sign in to comment.