lithium\test\Unit::assertCookie()
Assert Cookie data is properly set in headers.
The value passed to exepected is an array of the cookie data, with at least the key and
value expected, but can support any of the following keys:
key: the expected keyvalue: the expected valuepath: optionally specifiy a pathname: optionally specify the cookie nameexpires: optionally assert a specific expire time
Parameters
-
array
$expected -
array
$headersWhen empty, value of
headers_list()is used.
Returns
booleantrue if the assertion succeeded, false otherwise.
Source
public function assertCookie($expected, $headers = null) {
$result = null;
$matched = $this->_cookieMatch($expected, $headers);
if (!$matched['match']) {
$message = sprintf('%s - Cookie not found in headers.', $matched['pattern']);
return $this->assert(false, $message, compact('expected', 'result'));
}
return $this->assert(true, '%s');
}