Merge "AutoLoader: Use require_once rather than require"
[mediawiki.git] / tests / phpunit / includes / exception / ThrottledErrorTest.php
bloba20c6b9bab53a3c0cf923e579ce8f4bf5a8186dd
1 <?php
3 use MediaWiki\Output\OutputPage;
5 /**
6 * @covers \ThrottledError
7 * @author Addshore
8 */
9 class ThrottledErrorTest extends MediaWikiIntegrationTestCase {
11 public function testExceptionSetsStatusCode() {
12 $mockOut = $this->createMock( OutputPage::class );
13 $mockOut->expects( $this->once() )
14 ->method( 'setStatusCode' )
15 ->with( 429 );
16 $this->setMwGlobals( 'wgOut', $mockOut );
18 try {
19 throw new ThrottledError();
20 } catch ( ThrottledError $e ) {
21 ob_start();
22 $e->report();
23 $text = ob_get_clean();
24 $this->assertStringContainsString( $e->getMessage(), $text );