Example #1
0
 /**
  * Sets a response cookie
  *
  * @param string $key           The name of the cookie
  * @param string $value         The value to set the cookie with
  * @param int $expiry           The time that the cookie should expire
  * @param string $path          The path of which to restrict the cookie
  * @param string $domain        The domain of which to restrict the cookie
  * @param boolean $secure       Flag of whether the cookie should only be sent over a HTTPS connection
  * @param boolean $httponly     Flag of whether the cookie should only be accessible over the HTTP protocol
  * @access public
  * @return Response
  */
 public function cookie($key, $value = '', $expiry = null, $path = '/', $domain = null, $secure = false, $httponly = false)
 {
     if (null === $expiry) {
         $expiry = time() + 3600 * 24 * 30;
     }
     $this->cookies->set($key, new ResponseCookie($key, $value, $expiry, $path, $domain, $secure, $httponly));
     return $this;
 }
 public function testSetStringConvertsToCookie()
 {
     // Create our collection with NO data
     $data_collection = new ResponseCookieDataCollection();
     // Set our data from our test data
     $data_collection->set('first', 'value');
     $this->assertNotSame('value', $data_collection->get('first'));
     $this->assertTrue($data_collection->get('first') instanceof ResponseCookie);
 }