getRequestCookies() public method

public getRequestCookies ( $raw = false )
 public function testCollect()
 {
     $c = new RequestDataCollector();
     $c->collect($request = $this->createRequest(), $this->createResponse());
     $cloner = new VarCloner();
     $attributes = $c->getRequestAttributes();
     $this->assertSame('request', $c->getName());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\HeaderBag', $c->getRequestHeaders());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestServer());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestCookies());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $attributes);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestRequest());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestQuery());
     $this->assertSame('html', $c->getFormat());
     $this->assertEquals('foobar', $c->getRoute());
     $this->assertEquals($cloner->cloneVar(array('name' => 'foo')), $c->getRouteParams());
     $this->assertSame(array(), $c->getSessionAttributes());
     $this->assertSame('en', $c->getLocale());
     $this->assertEquals($cloner->cloneVar($request->attributes->get('resource')), $attributes->get('resource'));
     $this->assertEquals($cloner->cloneVar($request->attributes->get('object')), $attributes->get('object'));
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\HeaderBag', $c->getResponseHeaders());
     $this->assertSame('OK', $c->getStatusText());
     $this->assertSame(200, $c->getStatusCode());
     $this->assertSame('application/json', $c->getContentType());
 }
Example #2
0
 /**
  * Returns the routing traces associated to the given request.
  *
  * @param RequestDataCollector $request
  * @param string               $method
  *
  * @return array
  */
 private function getTraces(RequestDataCollector $request, $method)
 {
     $traceRequest = Request::create($request->getPathInfo(), $request->getRequestServer()->get('REQUEST_METHOD'), $request->getRequestAttributes()->all(), $request->getRequestCookies()->all(), array(), $request->getRequestServer()->all());
     $context = $this->matcher->getContext();
     $context->setMethod($method);
     $matcher = new TraceableUrlMatcher($this->routes, $context);
     return $matcher->getTracesForRequest($traceRequest);
 }
 /**
  * @dataProvider provider
  */
 public function testCollect(Request $request, Response $response)
 {
     $c = new RequestDataCollector();
     $c->collect($request, $response);
     $this->assertSame('request', $c->getName());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\HeaderBag', $c->getRequestHeaders());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestServer());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestCookies());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestAttributes());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestRequest());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\ParameterBag', $c->getRequestQuery());
     $this->assertEquals('html', $c->getFormat());
     $this->assertEquals(array(), $c->getSessionAttributes());
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\HeaderBag', $c->getResponseHeaders());
     $this->assertEquals(200, $c->getStatusCode());
     $this->assertEquals('application/json', $c->getContentType());
 }