Go to the documentation of this file.
27 $this->obLevel = ob_get_level();
33 while ( ob_get_level() > $this->obLevel ) {
38 $this->fail(
"Test changed output buffer level: was {$this->obLevel}" .
39 "before test, but $obLevel after test."
62 $request->response()->header(
'Status: 200 OK',
true, 200 );
73 $output->setTitle( $this->interfaceTitle );
82 $cases[] = [
'', [], [],
'!!', 400 ];
84 $cases[] = [
'', [
'target' =>
'Helsinki' ], [],
'!!', 303, [
'Location' =>
'!.+!' ] ];
87 foreach ( $cases
as $c ) {
91 if ( isset( $case[1][
'target'] ) ) {
92 $case[0] .= $case[1][
'target'];
93 unset( $case[1][
'target'] );
96 $subpageCases[] = $case;
99 $cases = array_merge( $cases, $subpageCases );
103 [
'target' =>
'Helsinki' ],
104 [
'Accept' =>
'text/HTML' ],
107 [
'Location' =>
'!Helsinki$!' ]
113 'target' =>
'Helsinki',
114 'revision' =>
'4242',
116 [
'Accept' =>
'text/HTML' ],
119 [
'Location' =>
'!Helsinki(\?|&)oldid=4242!' ]
128 [
'Location' =>
'!Helsinki&action=raw!' ]
135 [
'Accept' =>
'text/foobar' ],
144 [
'Accept' =>
'text/HTML' ],
147 [
'Location' =>
'!Helsinki$!' ]
153 [
'Accept' =>
'text/HTML' ],
156 [
'Location' =>
'!Helsinki$!' ]
162 [
'Accept' =>
'text/HTML' ],
165 [
'Location' =>
'!AC/DC$!' ]
186 $expectedStatusCode = 200,
187 array $expectedHeaders = []
202 if (
$output->getRedirect() !==
'' ) {
207 $text = ob_get_contents();
210 $this->assertEquals( $expectedStatusCode,
$response->getStatusCode(),
'status code' );
211 $this->assertRegExp( $expectedOutput, $text,
'output' );
213 foreach ( $expectedHeaders
as $name => $exp ) {
215 $this->assertNotNull(
$value,
"header: $name" );
216 $this->assertInternalType(
'string',
$value,
"header: $name" );
217 $this->assertRegExp( $exp,
$value,
"header: $name" );
221 $this->assertEquals( $expectedStatusCode,
$e->getStatusCode(),
'status code' );
222 $this->assertRegExp( $expectedOutput,
$e->getHTML(),
'error output' );
226 $this->assertSame(
'*',
$response->getHeader(
'Access-Control-Allow-Origin' ) );
232 'Accept Header of HTML' => [
234 [
'ACCEPT' =>
'text/html' ],
237 'Accept Header without weights' => [
239 [
'ACCEPT' =>
'*/*, text/html, text/x-wiki' ],
240 'Helsinki&action=raw'
242 'Accept Header with weights' => [
244 [
'ACCEPT' =>
'text/*; q=0.5, text/json; q=0.7, application/rdf+xml; q=0.8' ],
245 'Helsinki&action=raw'
247 'Accept Header accepting evertyhing and HTML' => [
249 [
'ACCEPT' =>
'text/html, */*' ],
250 'Helsinki&action=raw'
252 'No Accept Header' => [
255 'Helsinki&action=raw'
272 $expectedRedirectSuffix
281 $this->assertStringEndsWith(
282 $expectedRedirectSuffix,
WebRequest clone which takes values from a provided array.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
makeOutputPage(array $params, array $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 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
Request handler implementing a data interface for mediawiki pages.
provideHttpContentNegotiation()
testHttpContentNegotiation(Title $title, array $headers, $expectedRedirectSuffix)
provideHttpContentNegotiation
Allows to change the fields on the form that will be generated $name
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
Show an error that looks like an HTTP server error.
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
An IContextSource implementation which will inherit context from another source but allow individual ...
namespace and then decline to actually register it file or subcat img or subcat $title
This class should be covered by a general architecture document which does not exist as of January 20...
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
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
testHandleRequest( $subpage, array $params, array $headers, $expectedOutput, $expectedStatusCode=200, array $expectedHeaders=[])
handleRequestProvider
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
static getMain()
Static methods.
this hook is for auditing only $response
Represents a title within MediaWiki.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
the array() calling protocol came about after MediaWiki 1.4rc1.