The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
31 lines
677 B
PHP
31 lines
677 B
PHP
<?php
|
|
|
|
/**
|
|
* @covers ThrottledError
|
|
* @author Addshore
|
|
*/
|
|
class ThrottledErrorTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function testExceptionSetsStatusCode() {
|
|
$this->setMwGlobals( 'wgOut', $this->getMockWgOut() );
|
|
try {
|
|
throw new ThrottledError();
|
|
} catch ( ThrottledError $e ) {
|
|
ob_start();
|
|
$e->report();
|
|
$text = ob_get_clean();
|
|
$this->assertStringContainsString( $e->getText(), $text );
|
|
}
|
|
}
|
|
|
|
private function getMockWgOut() {
|
|
$mock = $this->getMockBuilder( OutputPage::class )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
$mock->expects( $this->once() )
|
|
->method( 'setStatusCode' )
|
|
->with( 429 );
|
|
return $mock;
|
|
}
|
|
|
|
}
|