Skip to content

Commit

Permalink
Adding test case for CakeResponse::mapType()
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 3, 2010
1 parent 7e1426e commit 4a8e44b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cake/tests/cases/libs/cake_response.test.php
Expand Up @@ -334,4 +334,19 @@ public function testDownload() {
$this->assertEquals($response->header(), $expected);
}

/**
* Tests the mapType method
*
*/
public function testMapType() {
$response = new CakeResponse();
$this->assertEquals('wav', $response->mapType('audio/x-wav'));
$this->assertEquals('pdf', $response->mapType('application/pdf'));
$this->assertEquals('xml', $response->mapType('text/xml'));
$this->assertEquals('html', $response->mapType('*/*'));
$this->assertEquals('csv', $response->mapType('application/vnd.ms-excel'));
$expected = array('json', 'xhtml', 'css');
$result = $response->mapType(array('application/json', 'application/xhtml+xml', 'text/css'));
$this->assertEquals($expected, $result);
}
}

0 comments on commit 4a8e44b

Please sign in to comment.