示例#1
0
 public function testSetters()
 {
     $request = new Request('GET', '/bar');
     $headers = range(1, 20);
     $request->setHeaders($headers);
     $this->assertSame($headers, $request->getHeaders());
     $parameters = range(1, 20);
     $request->setParameters($parameters);
     $this->assertSame($parameters, $request->getParameters());
     $content = 'foobar';
     $request->setContent($content);
     $this->assertSame($content, $request->getContent());
 }
 public function testConvert()
 {
     $uri = '/foo';
     $method = 'POST';
     $parameters = array('a' => 1, 'b' => 2);
     $headers = array('c' => 3, 'd' => 4);
     $content = 'ups';
     $request = new Request($method, $uri);
     $request->setParameters($parameters);
     $request->setHeaders($headers);
     $request->setContent($content);
     $cookies = array();
     $files = array();
     $server = array('HTTP_c' => 3, 'HTTP_d' => 4);
     $symfonyRequest = SymfonyRequest::create($uri, $method, $parameters, $cookies, $files, $server, $content);
     $converter = new SymfonyHttpFoundationRequestConverter();
     $this->assertEquals($symfonyRequest, $converter->convert($request));
 }
示例#3
0
 private function createRequest($method, $uri)
 {
     $request = new Request($method, $uri);
     $request->setParameters($this->requestParameters);
     $request->setHeaders($this->requestHeaders);
     $request->setContent($this->requestContent);
     return $this->filterRequest($request);
 }