From 4a8e44b4191b01c7aedcfea7e10871fb9522e6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Mon, 2 Aug 2010 19:33:09 -0430 Subject: [PATCH] Adding test case for CakeResponse::mapType() --- cake/tests/cases/libs/cake_response.test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cake/tests/cases/libs/cake_response.test.php b/cake/tests/cases/libs/cake_response.test.php index bc3444451..80c2a6a76 100644 --- a/cake/tests/cases/libs/cake_response.test.php +++ b/cake/tests/cases/libs/cake_response.test.php @@ -334,4 +334,19 @@ class CakeResponseTestCase extends CakeTestCase { $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); + } } \ No newline at end of file