/** * Normalise cookie data into a Requests_Cookie * * @param string|Requests_Cookie $cookie * @return Requests_Cookie */ public function normalize_cookie($cookie, $key = null) { if ($cookie instanceof Requests_Cookie) { return $cookie; } return Requests_Cookie::parse($cookie, $key); }
public function testEmptyAttributes() { $cookie = Requests_Cookie::parse('foo=bar; HttpOnly'); $this->assertTrue($cookie->attributes['httponly']); }
/** * Double-normalizes the cookie data to ensure we catch any issues there * * @dataProvider parseResultProvider */ public function testParsingHeaderDouble($header, $expected, $expected_attributes = array(), $expected_flags = array()) { // Set the reference time to 2014-01-01 00:00:00 $reference_time = gmmktime(0, 0, 0, 1, 1, 2014); $cookie = Requests_Cookie::parse($header, null, $reference_time); // Normalize the value again $cookie->normalize(); $this->check_parsed_cookie($cookie, $expected, $expected_attributes, $expected_flags); }