From now on I will simply use addshore everywhere to keep things uniform... Change-Id: Iaf441b2d7a67a12c20529f0e9c7b47819f4abfae
29 lines
587 B
PHP
29 lines
587 B
PHP
<?php
|
|
|
|
/**
|
|
* @covers ThrottledError
|
|
* @author Addshore
|
|
*/
|
|
class ThrottledErrorTest extends MediaWikiTestCase {
|
|
|
|
public function testExceptionSetsStatusCode() {
|
|
$this->setMwGlobals( 'wgOut', $this->getMockWgOut() );
|
|
try {
|
|
throw new ThrottledError();
|
|
} catch ( ThrottledError $e ) {
|
|
$e->report();
|
|
$this->assertTrue( true );
|
|
}
|
|
}
|
|
|
|
private function getMockWgOut() {
|
|
$mock = $this->getMockBuilder( 'OutputPage' )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
$mock->expects( $this->once() )
|
|
->method( 'setStatusCode' )
|
|
->with( 429 );
|
|
return $mock;
|
|
}
|
|
|
|
}
|