예제 #1
0
 /**
  * @param $key
  *
  * @return Cookie
  */
 public function getCookie($key)
 {
     if ($cookieValue = $this->request->cookies()->get($key)) {
         $cookie = new Cookie();
         $cookie->setName($key);
         $cookie->setValue($cookieValue);
         return $cookie;
     }
     return null;
 }
예제 #2
0
 public function testConstructorAndGetters()
 {
     // Test data
     $params_get = array('get');
     $params_post = array('post');
     $cookies = array('cookies');
     $server = array('server');
     $files = array('files');
     $body = 'body';
     // Create the request
     $request = new Request($params_get, $params_post, $cookies, $server, $files, $body);
     // Make sure our data's the same
     $this->assertSame($params_get, $request->paramsGet()->all());
     $this->assertSame($params_post, $request->paramsPost()->all());
     $this->assertSame($cookies, $request->cookies()->all());
     $this->assertSame($server, $request->server()->all());
     $this->assertSame($files, $request->files()->all());
     $this->assertSame($body, $request->body());
 }