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 ) {
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 );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
testSetCookieEmulated( $urlEncode, $name, $value, $options, $expected)
provideSetCookieEmulated
static provideSetCookieEmulated()
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add headers
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
the value of this variable comes from LanguageConverter indexed by page_id indexed by prefixed DB keys can modify can modify can modify this should be populated with an alert message to that effect to be fed to an HTMLForm object and populate $result with the reason in the form of error messages should be plain text with no special etc to show that they re errors
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
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php