Exemplo n.º 1
0
 public function testDefaults()
 {
     $request = new Request();
     $this->assertSame('GET / HTTP/1.0', $request->getStartLine());
     $this->assertSame('1.0', $request->getProtocolVersion());
     $this->assertNull($request->getBody());
     $this->assertSame([], $request->getHeaders());
     $this->assertSame([], $request->getQuery());
     $this->assertSame([], $request->getPost());
     $this->assertSame([], $request->getCookie());
     $this->assertSame([], $request->getFiles());
     $this->assertFalse($request->isSecure());
     $this->assertSame('GET', $request->getMethod());
     $this->assertSame('localhost', $request->getHost());
     $this->assertSame(80, $request->getPort());
     $this->assertSame('/', $request->getRequestUri());
     $this->assertSame('/', $request->getPath());
     $this->assertSame('', $request->getQueryString());
     $this->assertSame('0.0.0.0', $request->getClientIp());
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getRequestParameters(Request $request)
 {
     return $request->getQuery();
 }
Exemplo n.º 3
0
Arquivo: Form.php Projeto: brick/form
 /**
  * Populates the form with the request data.
  *
  * @param \Brick\Http\Request $request
  *
  * @return \Brick\Form\Form
  */
 public function populateFromRequest(Request $request)
 {
     return $this->populate($this->isMethodPost() ? $request->getPost() : $request->getQuery());
 }