6 protected function setUp() {
10 'wgServer' =>
'http://example.org',
11 'wgScriptPath' =>
'/w',
12 'wgScript' =>
'/w/index.php',
13 'wgArticlePath' =>
'/wiki/$1',
14 'wgActionPaths' => [],
18 $this->oldServer = $_SERVER;
19 $this->oldGet = $_GET;
20 $this->oldPost = $_POST;
34 'url' =>
'http://example.org/wiki/Foo_Bar',
41 'url' =>
'http://example.org/wiki/Foo%20Bar',
44 'redirect' =>
'http://example.org/wiki/Foo_Bar',
48 'url' =>
'http://example.org/w/index.php?title=Foo_Bar',
49 'query' => [
'title' =>
'Foo_Bar' ],
55 'url' =>
'http://example.org/w/index.php?curid=123',
56 'query' => [
'curid' =>
'123' ],
62 'url' =>
'http://example.org/w/index.php?oldid=123',
63 'query' => [
'oldid' =>
'123' ],
69 'url' =>
'http://example.org/w/index.php',
71 'title' =>
'Main_Page',
72 'redirect' =>
'http://example.org/wiki/Main_Page',
76 'url' =>
'http://example.org/w/index.php?title=',
77 'query' => [
'title' =>
'' ],
78 'title' =>
'Main_Page',
79 'redirect' =>
'http://example.org/wiki/Main_Page',
83 'url' =>
'http://example.org/w/index.php?title=Foo%20Bar',
84 'query' => [
'title' =>
'Foo Bar' ],
86 'redirect' =>
'http://example.org/wiki/Foo_Bar',
90 'url' =>
'http://example.org/w/?title=Foo_Bar',
91 'query' => [
'title' =>
'Foo_Bar' ],
97 'url' =>
'http://example.org/?title=Foo_Bar',
98 'query' => [
'title' =>
'Foo_Bar' ],
104 'url' =>
'http://example.org/wiki/Foo_Bar?action=view',
105 'query' => [
'action' =>
'view' ],
106 'title' =>
'Foo_Bar',
111 'url' =>
'http://example.org/wiki/Foo_Bar?action=edit',
112 'query' => [
'action' =>
'edit' ],
113 'title' =>
'Foo_Bar',
118 'url' =>
'http://example.org/w/index.php?title=Foo_Bar&action=view',
119 'query' => [
'title' =>
'Foo_Bar',
'action' =>
'view' ],
120 'title' =>
'Foo_Bar',
125 'url' =>
'http://example.org/w/index.php?title=Foo_Bar&action=edit',
126 'query' => [
'title' =>
'Foo_Bar',
'action' =>
'edit' ],
127 'title' =>
'Foo_Bar',
132 'url' =>
'http://example.org//wiki/Double_slash',
134 'title' =>
'Double_slash',
139 'url' =>
'http://example.org/w/index.php?title=Media:Foo_Bar',
140 'query' => [
'title' =>
'Foo_Bar' ],
141 'title' =>
'File:Foo_Bar',
142 'redirect' =>
'http://example.org/wiki/File:Foo_Bar',
155 $_SERVER[
'REQUEST_URI'] = $url;
161 $req->interpolateTitle();
163 $titleObj = Title::newFromText( $title );
166 $context = RequestContext::getMain();
172 $method =
new ReflectionMethod( $mw,
'tryNormaliseRedirect' );
173 $method->setAccessible(
true );
174 $ret = $method->invoke( $mw, $titleObj );
177 $expectedRedirect !==
false,
179 'Return true only when redirecting'
183 $expectedRedirect ?:
'',
184 $context->getOutput()->getRedirect()
199 DeferredUpdates::addCallableUpdate(
function () use (
$response, &$jobHasRun ) {
201 $response->setCookie(
'JobCookie',
'yes' );
206 $this->
setTemporaryHook(
'WebResponseSetCookie',
function () use ( &$hookWasRun ) {
212 $logger->setCollect(
true );
217 $mw->doPostOutputShutdown();
221 if ( $jobHasRun ===
false ) {
225 $this->assertTrue( $jobHasRun,
'post-send job has run' );
226 $this->assertFalse( $hookWasRun,
227 'post-send job must not trigger WebResponseSetCookie hook' );
230 [
'info',
'ignored post-send cookie {cookie}' ],
231 [
'info',
'ignored post-send header {header}' ],
A logger that may be configured to either buffer logs or to print them to the output where PHPUnit wi...
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
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