/** * Returns all cookies attached to the headers of this message * * This is a shortcut for $message->getHeaders()->getCookies(); * * @return array An array of Cookie objects * @api */ public function getCookies() { return $this->headers->getCookies(); }
/** * @test */ public function getCookiesReturnsAllCookies() { $cookies = array('Dark-Chocolate-Chip' => new Cookie('Dark-Chocolate-Chip'), 'Pecan-Maple-Choc' => new Cookie('Pecan-Maple-Choc'), 'Coffee-Fudge-Mess' => new Cookie('Coffee-Fudge-Mess')); $headers = new Headers(); $headers->setCookie($cookies['Dark-Chocolate-Chip']); $headers->setCookie($cookies['Pecan-Maple-Choc']); $headers->setCookie($cookies['Coffee-Fudge-Mess']); $headers->eatCookie('Coffee-Fudge-Mess'); unset($cookies['Coffee-Fudge-Mess']); $this->assertEquals($cookies, $headers->getCookies()); }