]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - tests/phpunit/includes/exception/ThrottledErrorTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / includes / exception / ThrottledErrorTest.php
1 <?php
2
3 /**
4  * @covers ThrottledError
5  * @author Addshore
6  */
7 class ThrottledErrorTest extends MediaWikiTestCase {
8
9         public function testExceptionSetsStatusCode() {
10                 $this->setMwGlobals( 'wgOut', $this->getMockWgOut() );
11                 try {
12                         throw new ThrottledError();
13                 } catch ( ThrottledError $e ) {
14                         $e->report();
15                         $this->assertTrue( true );
16                 }
17         }
18
19         private function getMockWgOut() {
20                 $mock = $this->getMockBuilder( 'OutputPage' )
21                         ->disableOriginalConstructor()
22                         ->getMock();
23                 $mock->expects( $this->once() )
24                         ->method( 'setStatusCode' )
25                         ->with( 429 );
26                 return $mock;
27         }
28
29 }