16 $page->getContext()->setOutput(
new OutputPage( $page->getContext() ) );
26 $cases[
'Empty request'] = [
'', [], [],
'!!', 200 ];
28 $cases[
'Only title specified'] = [
30 [
'target' =>
'Helsinki' ],
34 [
'Location' =>
'!.+!' ]
37 $cases[
'Accept only HTML'] = [
39 [
'target' =>
'Helsinki' ],
40 [
'Accept' =>
'text/HTML' ],
43 [
'Location' =>
'!Helsinki$!' ]
46 $cases[
'Accept only HTML with revid'] = [
49 'target' =>
'Helsinki',
52 [
'Accept' =>
'text/HTML' ],
55 [
'Location' =>
'!Helsinki(\?|&)oldid=4242!' ]
58 $cases[
'Nothing specified'] = [
64 [
'Location' =>
'!Helsinki&action=raw!' ]
67 $cases[
'Nothing specified'] = [
73 [
'Location' =>
'!Helsinki&action=raw!' ]
76 $cases[
'Invalid Accept header'] = [
79 [
'Accept' =>
'text/foobar' ],
104 array $expHeaders = []
107 $request->response()->header(
'Status: 200 OK',
true, 200 );
109 foreach ( $headers as $name =>
$value ) {
117 $this->assertEquals( $expCode,
$response->getStatusCode(),
"status code" );
118 $this->assertRegExp( $expRegExp,
$output,
"output" );
120 foreach ( $expHeaders as $name => $exp ) {
122 $this->assertNotNull(
$value,
"header: $name" );
123 $this->assertInternalType(
'string',
$value,
"header: $name" );
124 $this->assertRegExp( $exp,
$value,
"header: $name" );
127 $this->assertEquals( $expCode,
$e->getStatusCode(),
"status code" );
128 $this->assertRegExp( $expRegExp,
$e->getHTML(),
"error output" );
135 $request->response()->header(
'Status: 200 OK',
true, 200 );
139 $this->assertContains(
140 "Content negotiation applies based on your client's Accept header.",
WebRequest clone which takes values from a provided array.
Show an error that looks like an HTTP server error.
This class should be covered by a general architecture document which does not exist as of January 20...
Request handler implementing a data interface for mediawiki pages.
SpecialPageData Database SpecialPage.
testSpecialPageWithoutParameters()
newSpecialPage()
Returns a new instance of the special page under test.
testExecute( $subpage, array $params, array $headers, $expRegExp, $expCode=200, array $expHeaders=[])
provideExecute
Base class for testing special pages.
executeSpecialPage( $subPage='', WebRequest $request=null, $language=null, User $user=null)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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 $request
this hook is for auditing only $response
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
returning false will NOT prevent logging $e
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))