Pass phpcs-strict on some test files (9/11)
[mediawiki.git] / tests / phpunit / includes / exception / ThrottledErrorTest.php
blobbdb143faaf2e7f3087fa23fb437e8af0a8fe57a1
1 <?php
3 /**
4 * @covers ThrottledError
5 * @author Adam Shorland
6 */
7 class ThrottledErrorTest extends MediaWikiTestCase {
9 protected $wgOut;
11 protected function setUp() {
12 parent::setUp();
13 global $wgOut;
14 $this->wgOut = clone $wgOut;
17 protected function tearDown() {
18 parent::tearDown();
19 global $wgOut;
20 $wgOut = $this->wgOut;
23 public function testExceptionSetsStatusCode() {
24 global $wgOut;
25 $wgOut = $this->getMockWgOut();
26 try {
27 throw new ThrottledError();
28 } catch ( ThrottledError $e ) {
29 $e->report();
30 $this->assertTrue( true );
34 private function getMockWgOut() {
35 $mock = $this->getMockBuilder( 'OutputPage' )
36 ->disableOriginalConstructor()
37 ->getMock();
38 $mock->expects( $this->once() )
39 ->method( 'setStatusCode' )
40 ->with( 429 );
41 return $mock;