Go to the documentation of this file.
23 $this->obLevel = ob_get_level();
31 while ( ob_get_level() > $this->obLevel ) {
36 $this->fail(
"Test changed output buffer level: was {$this->obLevel}" .
37 "before test, but $obLevel after test."
60 $request->response()->header(
'Status: 200 OK',
true, 200 );
71 $output->setTitle( $this->interfaceTitle );
80 $cases[] = [
'', [], [],
'Invalid title', 400 ];
84 [
'target' =>
'Helsinki' ],
88 [
'Location' =>
'?title=Helsinki&action=raw' ]
92 foreach ( $cases
as $c ) {
96 if ( isset( $case[1][
'target'] ) ) {
97 $case[0] .= $case[1][
'target'];
98 unset( $case[1][
'target'] );
101 $subpageCases[] = $case;
104 $cases = array_merge( $cases, $subpageCases );
108 [
'target' =>
'Helsinki' ],
109 [
'Accept' =>
'text/HTML' ],
112 [
'Location' =>
'/wiki/Helsinki' ]
118 'target' =>
'Helsinki',
119 'revision' =>
'4242',
121 [
'Accept' =>
'text/HTML' ],
124 [
'Location' =>
'?title=Helsinki&oldid=4242' ]
133 [
'Location' =>
'?title=Helsinki&action=raw' ]
140 [
'Accept' =>
'text/foobar' ],
141 'No matching format found',
148 [
'Accept' =>
'text/HTML' ],
156 [
'Accept' =>
'text/HTML' ],
164 [
'Accept' =>
'text/HTML' ],
172 [
'Accept' =>
'text/HTML' ],
175 [
'Location' =>
'/wiki/Helsinki' ]
181 [
'Accept' =>
'text/HTML' ],
184 [
'Location' =>
'/wiki/Helsinki' ]
190 [
'Accept' =>
'text/HTML' ],
193 [
'Location' =>
'/wiki/AC/DC' ]
213 $expectedOutput =
'',
214 $expectedStatusCode = 200,
215 array $expectedHeaders = []
230 if (
$output->getRedirect() !==
'' ) {
235 $text = ob_get_clean();
237 $this->assertEquals( $expectedStatusCode,
$response->getStatusCode(),
'status code' );
238 $this->assertSame( $expectedOutput, $text,
'output' );
240 foreach ( $expectedHeaders
as $name => $exp ) {
242 $this->assertNotNull(
$value,
"header: $name" );
243 $this->assertInternalType(
'string',
$value,
"header: $name" );
244 $this->assertStringEndsWith( $exp,
$value,
"header: $name" );
248 $this->assertEquals( $expectedStatusCode,
$e->getStatusCode(),
'status code' );
249 $this->assertContains( $expectedOutput,
$e->getHTML(),
'error output' );
253 $this->assertSame(
'*',
$response->getHeader(
'Access-Control-Allow-Origin' ) );
259 'Accept Header of HTML' => [
261 [
'ACCEPT' =>
'text/html' ],
264 'Accept Header without weights' => [
266 [
'ACCEPT' =>
'*/*, text/html, text/x-wiki' ],
267 'Helsinki&action=raw'
269 'Accept Header with weights' => [
271 [
'ACCEPT' =>
'text/*; q=0.5, text/json; q=0.7, application/rdf+xml; q=0.8' ],
272 'Helsinki&action=raw'
274 'Accept Header accepting evertyhing and HTML' => [
276 [
'ACCEPT' =>
'text/html, */*' ],
277 'Helsinki&action=raw'
279 'No Accept Header' => [
282 'Helsinki&action=raw'
299 $expectedRedirectSuffix
308 $this->assertStringEndsWith(
309 $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)
PageDataRequestHandler PageData.
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
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 hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
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))
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
Allows to change the fields on the form that will be generated $name
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static getMain()
Get the RequestContext object associated with the main request.
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
testHandleRequest( $subpage, array $params, array $headers, $expectedOutput='', $expectedStatusCode=200, array $expectedHeaders=[])
handleRequestProvider