MediaWiki  1.27.2
HttpErrorTest.php
Go to the documentation of this file.
1 <?php
2 
9 
10  public function testIsLoggable() {
11  $httpError = new HttpError( 500, 'server error!' );
12  $this->assertFalse( $httpError->isLoggable(), 'http error is not loggable' );
13  }
14 
15  public function testGetStatusCode() {
16  $httpError = new HttpError( 500, 'server error!' );
17  $this->assertEquals( 500, $httpError->getStatusCode() );
18  }
19 
23  public function testGetHtml( array $expected, $content, $header ) {
24  $httpError = new HttpError( 500, $content, $header );
25  $errorHtml = $httpError->getHTML();
26 
27  foreach ( $expected as $key => $html ) {
28  $this->assertContains( $html, $errorHtml, $key );
29  }
30  }
31 
32  public function getHtmlProvider() {
33  return [
34  [
35  [
36  'head html' => '<head><title>Server Error 123</title></head>',
37  'body html' => '<body><h1>Server Error 123</h1>'
38  . '<p>a server error!</p></body>'
39  ],
40  'a server error!',
41  'Server Error 123'
42  ],
43  [
44  [
45  'head html' => '<head><title>loginerror</title></head>',
46  'body html' => '<body><h1>loginerror</h1>'
47  . '<p>suspicious-userlogout</p></body>'
48  ],
49  new RawMessage( 'suspicious-userlogout' ),
50  new RawMessage( 'loginerror' )
51  ],
52  [
53  [
54  'head html' => '<html><head><title>Internal Server Error</title></head>',
55  'body html' => '<body><h1>Internal Server Error</h1>'
56  . '<p>a server error!</p></body></html>'
57  ],
58  'a server error!',
59  null
60  ]
61  ];
62  }
63 }
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 just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1798
the array() calling protocol came about after MediaWiki 1.4rc1.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Definition: hooks.txt:2321
Show an error that looks like an HTTP server error.
Definition: HttpError.php:30
testGetHtml(array $expected, $content, $header)
getHtmlProvider
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
Definition: distributors.txt:9
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
Definition: injection.txt:35
Variant of the Message class.
Definition: Message.php:1232
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition: hooks.txt:1004