Error messages are not guaranteed to be stable, and these tests prevent us from improving them. Error codes are supposed to be stable, so we should be asserting that they do not change (especially since many of them are dynamically generated by the dodgy code in ApiMessageTrait). Introduce helpers assertApiErrorCode() and expectApiErrorCode() to be used instead of the usual PHPUnit assertions/expectations for this case. Change-Id: I752f82f29bf5f9405ea117ebf9e5cf70335464ad
18 lines
341 B
PHP
18 lines
341 B
PHP
<?php
|
|
|
|
/**
|
|
* @group API
|
|
* @group medium
|
|
*
|
|
* @covers ApiDisabled
|
|
*/
|
|
class ApiDisabledTest extends ApiTestCase {
|
|
public function testDisabled() {
|
|
$this->mergeMwGlobalArrayValue( 'wgAPIModules',
|
|
[ 'login' => 'ApiDisabled' ] );
|
|
|
|
$this->expectApiErrorCode( 'moduledisabled' );
|
|
|
|
$this->doApiRequest( [ 'action' => 'login' ] );
|
|
}
|
|
}
|