rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / exception / HttpErrorTest.php
blob90ccd1e551d0638bb39076a0cbb6c4d4e782e202
1 <?php
3 /**
4 * @todo tests for HttpError::report
6 * @covers HttpError
7 */
8 class HttpErrorTest extends MediaWikiTestCase {
10 public function testIsLoggable() {
11 $httpError = new HttpError( 500, 'server error!' );
12 $this->assertFalse( $httpError->isLoggable(), 'http error is not loggable' );
15 public function testGetStatusCode() {
16 $httpError = new HttpError( 500, 'server error!' );
17 $this->assertEquals( 500, $httpError->getStatusCode() );
20 /**
21 * @dataProvider getHtmlProvider
23 public function testGetHtml( array $expected, $content, $header ) {
24 $httpError = new HttpError( 500, $content, $header );
25 $errorHtml = $httpError->getHTML();
27 foreach ( $expected as $key => $html ) {
28 $this->assertContains( $html, $errorHtml, $key );
32 public function getHtmlProvider() {
33 return [
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>'
40 'a server error!',
41 'Server Error 123'
45 'head html' => '<head><title>loginerror</title></head>',
46 'body html' => '<body><h1>loginerror</h1>'
47 . '<p>suspicious-userlogout</p></body>'
49 new RawMessage( 'suspicious-userlogout' ),
50 new RawMessage( 'loginerror' )
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>'
58 'a server error!',
59 null