4 protected function setUp() {
8 'wgServer' =>
'http://example.org',
9 'wgScriptPath' =>
'/w',
10 'wgScript' =>
'/w/index.php',
11 'wgArticlePath' =>
'/wiki/$1',
12 'wgActionPaths' => [],
20 'url' =>
'http://example.org/wiki/Foo_Bar',
27 'url' =>
'http://example.org/wiki/Foo%20Bar',
30 'redirect' =>
'http://example.org/wiki/Foo_Bar',
34 'url' =>
'http://example.org/w/index.php?title=Foo_Bar',
35 'query' => [
'title' =>
'Foo_Bar' ],
41 'url' =>
'http://example.org/w/index.php?curid=123',
42 'query' => [
'curid' =>
'123' ],
48 'url' =>
'http://example.org/w/index.php?oldid=123',
49 'query' => [
'oldid' =>
'123' ],
55 'url' =>
'http://example.org/w/index.php',
57 'title' =>
'Main_Page',
58 'redirect' =>
'http://example.org/wiki/Main_Page',
62 'url' =>
'http://example.org/w/index.php?title=',
63 'query' => [
'title' =>
'' ],
64 'title' =>
'Main_Page',
65 'redirect' =>
'http://example.org/wiki/Main_Page',
69 'url' =>
'http://example.org/w/index.php?title=Foo%20Bar',
70 'query' => [
'title' =>
'Foo Bar' ],
72 'redirect' =>
'http://example.org/wiki/Foo_Bar',
76 'url' =>
'http://example.org/w/?title=Foo_Bar',
77 'query' => [
'title' =>
'Foo_Bar' ],
83 'url' =>
'http://example.org/?title=Foo_Bar',
84 'query' => [
'title' =>
'Foo_Bar' ],
90 'url' =>
'http://example.org/wiki/Foo_Bar?action=view',
91 'query' => [
'action' =>
'view' ],
97 'url' =>
'http://example.org/wiki/Foo_Bar?action=edit',
98 'query' => [
'action' =>
'edit' ],
104 'url' =>
'http://example.org/w/index.php?title=Foo_Bar&action=view',
105 'query' => [
'title' =>
'Foo_Bar',
'action' =>
'view' ],
106 'title' =>
'Foo_Bar',
111 'url' =>
'http://example.org/w/index.php?title=Foo_Bar&action=edit',
112 'query' => [
'title' =>
'Foo_Bar',
'action' =>
'edit' ],
113 'title' =>
'Foo_Bar',
126 $_SERVER[
'REQUEST_URI'] = $url;
129 $req->setRequestURL( $url );
131 $req->interpolateTitle();
133 $titleObj = Title::newFromText( $title );
142 $method =
new ReflectionMethod( $mw,
'tryNormaliseRedirect' );
143 $method->setAccessible(
true );
144 $ret = $method->invoke( $mw, $titleObj );
147 $expectedRedirect !==
false,
149 'Return true only when redirecting'
153 $expectedRedirect ?:
'',
154 $context->getOutput()->getRedirect()
169 DeferredUpdates::addCallableUpdate(
function () use (
$response, &$jobHasRun ) {
171 $response->setCookie(
'JobCookie',
'yes' );
176 $this->
setTemporaryHook(
'WebResponseSetCookie',
function () use ( &$hookWasRun ) {
182 $logger->setCollect(
true );
187 $mw->doPostOutputShutdown();
191 if ( $jobHasRun ===
false ) {
195 $this->assertTrue( $jobHasRun,
'post-send job has run' );
196 $this->assertFalse( $hookWasRun,
197 'post-send job must not trigger WebResponseSetCookie hook' );
200 [
'info',
'ignored post-send cookie {cookie}' ],
201 [
'info',
'ignored post-send header {header}' ],
WebRequest clone which takes values from a provided array.
static getMain()
Get the RequestContext object associated with the main request.
A logger that may be configured to either buffer logs or to print them to the output where PHPUnit wi...
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack ...
this hook is for auditing only $req
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 also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
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
this hook is for auditing only $response
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query