/** * Set a cookie * * @param HttpCookie $aCookie * The cookie to set * * @return boolean */ public function setCookie(HttpCookie $aCookie) { assert('$aCookie->getPath() !== null && $aCookie->getPath() !== ""'); $result = setcookie($aCookie->getName(), self::encode($aCookie->getValue()), $aCookie->getExpire(), $aCookie->getPath(), $aCookie->getDomain(), $aCookie->getSecure(), $aCookie->getHttponly()); if ($result === true) { $this->storedCookies[$aCookie->getName()] = $aCookie; } return $result; }
public function testHttpCookieSetAndGetValueMethod() { $cookie = new HttpCookie('testCookie'); $testValue = md5(time()); $cookie->setValue($testValue); $this->assertSame($testValue, $cookie->getValue()); }