Пример #1
0
 public function testSendCookies()
 {
     $headersSent = true;
     $headers = array();
     $cookies = array();
     UnitHeaderWrapper::setUp($headersSent, $headers, $cookies);
     $response = Response::make('', 302, array('Location' => 'foo.bar'));
     $response->setHeaderWrapper(new UnitHeaderWrapper());
     $response->addCookie(Cookie::make('foo'));
     $response->sendCookies();
     $this->assertCount(0, $cookies);
     $headersSent = false;
     $headers = array();
     $cookies = array();
     UnitHeaderWrapper::setUp($headersSent, $headers, $cookies);
     $response = Response::make('', 302, array('Location' => 'foo.bar'));
     $response->setHeaderWrapper(new UnitHeaderWrapper());
     $response->addCookie(Cookie::make('foo'));
     $response->sendCookies();
     $this->assertEquals('foo', $cookies[0]['name']);
 }
Пример #2
0
 public function testWithCookie()
 {
     $response = RedirectResponse::make('http://foo.bar');
     $response->withCookie(Cookie::make('foo'));
     $this->assertEquals(1, count($response->cookies));
 }
Пример #3
0
 public function testSetHttpOnly()
 {
     $cookie = Cookie::make('foo');
     $cookie->setHttpOnly(false);
     $this->assertFalse($cookie->isHttpOnly());
 }