public static function createFromRequest(BaseRequest $request)
 {
     $new = static::fromString($request->toString());
     $new->setQuery($request->getQuery());
     $new->setPost($request->getPost());
     $new->setCookies($request->getCookie());
     $new->setFiles($request->getFiles());
     $new->setServer($request->getServer());
     $new->setContent($request->getContent());
     $new->setEnv($request->getEnv());
     $headers = $request->getHeaders();
     $new->setHeaders($headers);
     return $new;
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider serverHeaderProvider
  * @param array  $server
  * @param string $name
  */
 public function testRequestStringHasCorrectHeaderName(array $server, $name)
 {
     $_SERVER = $server;
     $request = new Request();
     $this->assertContains($name, $request->toString());
 }