예제 #1
0
 public function testConvert()
 {
     $httpRequest = 'GET /foo/bar?foo=bar#test HTTP/1.1' . Http::$newLine;
     $httpRequest .= 'Content-type: text/html; charset=UTF-8' . Http::$newLine;
     $httpRequest .= Http::$newLine;
     $httpRequest .= 'foobar';
     $request = RequestParser::convert($httpRequest, new Url('http://psx.dev'));
     $this->assertEquals('http://psx.dev/foo/bar?foo=bar#test', $request->getUri()->toString());
     $this->assertEquals('GET', $request->getMethod());
     $this->assertEquals('HTTP/1.1', $request->getProtocolVersion());
     $this->assertEquals('text/html; charset=UTF-8', (string) $request->getHeader('Content-Type'));
     $this->assertEquals('foobar', $request->getBody());
 }