|
@@ -838,6 +838,30 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
$this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString());
|
|
$this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @dataProvider splitHttpAcceptHeaderData
|
|
|
|
+ */
|
|
|
|
+ public function testSplitHttpAcceptHeader($acceptHeader, $expected)
|
|
|
|
+ {
|
|
|
|
+ $request = new Request();
|
|
|
|
+
|
|
|
|
+ $this->assertEquals($expected, $request->splitHttpAcceptHeader($acceptHeader));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function splitHttpAcceptHeaderData()
|
|
|
|
+ {
|
|
|
|
+ return array(
|
|
|
|
+ array(null, array()),
|
|
|
|
+ array('text/html;q=0.8', array('text/html' => 0.8)),
|
|
|
|
+ array('text/html;foo=bar;q=0.8 ', array('text/html;foo=bar' => 0.8)),
|
|
|
|
+ array('text/html;charset=utf-8; q=0.8', array('text/html;charset=utf-8' => 0.8)),
|
|
|
|
+ array('text/html,application/xml;q=0.9,*/*;charset=utf-8; q=0.8', array('text/html' => 1, 'application/xml' => 0.9, '*/*;charset=utf-8' => 0.8)),
|
|
|
|
+ array('text/html,application/xhtml+xml;q=0.9,*/*;q=0.8; foo=bar', array('text/html' => 1, 'application/xhtml+xml' => 0.9, '*/*' => 0.8)),
|
|
|
|
+ array('text/html,application/xhtml+xml;charset=utf-8;q=0.9; foo=bar,*/*', array('text/html' => 1, '*/*' => 1, 'application/xhtml+xml;charset=utf-8' => 0.9)),
|
|
|
|
+ array('text/html,application/xhtml+xml', array('application/xhtml+xml' => 1, 'text/html' => 1)),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
class RequestContentProxy extends Request
|
|
class RequestContentProxy extends Request
|