Merge "Revert "selenium: add new message banner test to user spec""
[lhc/web/wiklou.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::class )
21 ->disableOriginalConstructor()
22 ->getMock();
23 $mock->expects( $this->once() )
24 ->method( 'setStatusCode' )
25 ->with( 429 );
26 return $mock;
27 }
28
29 }