Browse Source

Add test for accept header.

Refs #2828
mark_story 14 years ago
parent
commit
f6b33db02c
1 changed files with 16 additions and 0 deletions
  1. 16 0
      lib/Cake/Test/Case/Network/CakeRequestTest.php

+ 16 - 0
lib/Cake/Test/Case/Network/CakeRequestTest.php

@@ -930,6 +930,22 @@ class CakeRequestTest extends CakeTestCase {
 	}
 	}
 
 
 /**
 /**
+ * Test parsing accept with a confusing accept value.
+ *
+ * @return void
+ */
+	public function testParseAcceptNoQValues() {
+		$_SERVER['HTTP_ACCEPT'] = 'application/json, text/plain, */*';
+
+		$request = new CakeRequest('/', false);
+		$result = $request->parseAccept();
+		$expected = array(
+			'1.0' => array('application/json', 'text/plain', '*/*'),
+		);
+		$this->assertEquals($expected, $result);
+	}
+
+/**
  * testBaseUrlAndWebrootWithModRewrite method
  * testBaseUrlAndWebrootWithModRewrite method
  *
  *
  * @return void
  * @return void