コード例 #1
0
ファイル: RequestFactoryTest.php プロジェクト: norv/guzzle
 /**
  * @covers Guzzle\Http\Message\RequestFactory::fromMessage
  */
 public function testProperlyDealsWithDuplicateHeaders()
 {
     $parser = new MessageParser();
     $message = "POST / http/1.1\r\n" . "DATE:Mon, 09 Sep 2011 23:36:00 GMT\r\n" . "host:host.foo.com\r\n" . "ZOO:abc\r\n" . "ZOO:123\r\n" . "ZOO:HI\r\n" . "zoo:456\r\n\r\n";
     $parts = $parser->parseRequest($message);
     $this->assertEquals(array('DATE' => 'Mon, 09 Sep 2011 23:36:00 GMT', 'host' => 'host.foo.com', 'ZOO' => array('abc', '123', 'HI'), 'zoo' => '456'), $parts['headers']);
     $request = RequestFactory::getInstance()->fromMessage($message);
     $this->assertEquals(array('ZOO' => array('abc', '123', 'HI'), 'zoo' => array('456')), $request->getHeader('zoo')->raw());
 }
コード例 #2
0
ファイル: MessageParserTest.php プロジェクト: norv/guzzle
 /**
  * @covers Guzzle\Http\Parser\Message\MessageParser::parseMessage
  * @covers Guzzle\Http\Parser\Message\MessageParser::parseResponse
  * @dataProvider responseProvider
  */
 public function testParsesResponses($message, $parts)
 {
     $parser = new MessageParser();
     $this->compareResponseResults($parts, $parser->parseResponse($message));
 }