3use PHPUnit\Framework\TestCase;
14 'unrecognised key' => [
22 'Set-Cookie: a=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/',
24 'returnValue' =>
true,
26 'setcookie(): Unrecognized key \'foo\' found in the options array',
30 'no valid options' => [
37 'Set-Cookie: a=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0',
39 'returnValue' =>
true,
41 'setcookie(): Unrecognized key \'foo\' found in the options array',
42 'setcookie(): No valid options were found in the given array',
50 'returnValue' =>
false,
52 'Cookie names must not be empty',
60 'returnValue' =>
false,
62 'Cookie names cannot contain any of the following \'=,; \\t\\r\\n\\013\\014\'',
70 'returnValue' =>
false,
72 'Cookie values cannot contain any of the following \',; \\t\\r\\n\\013\\014\'',
76 'escaped invalid value' => [
82 'returnValue' =>
true,
87 true,
'a',
'b', [
'path' =>
"\n" ],
90 'returnValue' =>
false,
92 'Cookie paths cannot contain any of the following \',; \\t\\r\\n\\013\\014\'',
97 true,
'a',
'b', [
'domain' =>
"\013" ],
100 'returnValue' =>
false,
102 'Cookie domains cannot contain any of the following \',; \\t\\r\\n\\013\\014\'',
110 'Set-Cookie: a=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0',
112 'returnValue' =>
true,
122 'returnValue' =>
true,
132 'returnValue' =>
true,
136 'expires too large' => [
137 true,
'a',
'b', [
'expires' => 253430725200 ],
140 'returnValue' =>
false,
142 'Expiry date cannot have a year greater than 9999',
146 'expires in the past' => [
147 true,
'a',
'b', [
'expires' => 979477200 ],
150 'Set-Cookie: a=b; expires=Sun, 14-Jan-2001 13:00:00 GMT; Max-Age=0',
152 'returnValue' =>
true,
156 'expires in the future' => [
157 true,
'a',
'b', [
'expires' => 32504889600 ],
160 'Set-Cookie: a=b; expires=Wed, 15-Jan-3000 00:00:00 GMT; Max-Age=30911234470',
162 'returnValue' =>
true,
167 false,
'a',
'b', [
'path' =>
'%%' ],
170 'Set-Cookie: a=b; path=%%',
172 'returnValue' =>
true,
177 false,
'a',
'b', [
'domain' =>
'%%' ],
180 'Set-Cookie: a=b; domain=%%',
182 'returnValue' =>
true,
187 false,
'a',
'b', [
'secure' =>
true ],
190 'Set-Cookie: a=b; secure',
192 'returnValue' =>
true,
197 false,
'a',
'b', [
'httponly' =>
true ],
200 'Set-Cookie: a=b; HttpOnly',
202 'returnValue' =>
true,
207 false,
'a',
'b', [
'samesite' =>
'None' ],
210 'Set-Cookie: a=b; SameSite=None',
212 'returnValue' =>
true,
216 'multiple options' => [
218 'expires' => 32504889600,
226 'Set-Cookie: a=b; expires=Wed, 15-Jan-3000 00:00:00 GMT; Max-Age=30911234470; path=/%; domain=%.com; secure; HttpOnly',
228 'returnValue' =>
true,
241 public $headers = [];
244 protected function time() {
248 protected function error( $error ) {
249 $this->errors[] = $error;
252 protected function headers_sent() {
256 protected function header(
$header ) {
262 $this->assertSame( $expected[
'headers'], $instance->headers );
263 $this->assertSame( $expected[
'errors'], $instance->errors );
264 $this->assertSame( $expected[
'returnValue'],
$ret );
testSetCookieEmulated( $urlEncode, $name, $value, $options, $expected)
provideSetCookieEmulated
static provideSetCookieEmulated()
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret