/** * Removes the specified cookie from the headers of this message, if it exists * * This is a shortcut for $message->getHeaders()->removeCookie($name); * * Note: This will remove the cookie object from this Headers container. If you * intend to remove a cookie in the user agent (browser), you should call * the cookie's expire() method and _not_ remove the cookie from the Headers * container. * * @param string $name Name of the cookie to remove * @return void * @api */ public function removeCookie($name) { $this->headers->removeCookie($name); }
/** * @test */ public function cookiesCanBeRemoved() { $headers = new Headers(); $headers->setCookie(new Cookie('Dark-Chocolate-Chip')); $this->assertTrue($headers->hasCookie('Dark-Chocolate-Chip')); $headers->removeCookie('Dark-Chocolate-Chip'); $this->assertFalse($headers->hasCookie('Dark-Chocolate-Chip')); }