MediaWiki REL1_33
BadTitleErrorTest.php
Go to the documentation of this file.
1<?php
7
8 public function testExceptionSetsStatusCode() {
9 $this->setMwGlobals( 'wgOut', $this->getMockWgOut() );
10 try {
11 throw new BadTitleError();
12 } catch ( BadTitleError $e ) {
13 ob_start();
14 $e->report();
15 $text = ob_get_clean();
16 $this->assertContains( $e->getText(), $text );
17 }
18 }
19
20 private function getMockWgOut() {
21 $mock = $this->getMockBuilder( OutputPage::class )
22 ->disableOriginalConstructor()
23 ->getMock();
24 $mock->expects( $this->once() )
25 ->method( 'setStatusCode' )
26 ->with( 400 );
27 return $mock;
28 }
29
30}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Show an error page on a badtitle.
getText()
Get the text to display when reporting the error on the command line.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
returning false will NOT prevent logging $e
Definition hooks.txt:2175