private static $testGlobals = [
[
'MiserMode' => false,
- 'AllowCategorizedRecentChanges' => false,
],
[
'MiserMode' => true,
- 'AllowCategorizedRecentChanges' => true,
],
];
*/
private function checkMessage( $msg, $what ) {
$msg = ApiBase::makeMessage( $msg, self::getMain()->getContext() );
- $this->assertInstanceOf( 'Message', $msg, "$what message" );
+ $this->assertInstanceOf( Message::class, $msg, "$what message" );
$this->assertTrue( $msg->exists(), "$what message {$msg->getKey()} exists" );
}
foreach ( [ $paramsPlain, $paramsForHelp ] as $params ) {
foreach ( $params as $param => $config ) {
- if (
- isset( $config[ApiBase::PARAM_ISMULTI_LIMIT1] )
+ if ( isset( $config[ApiBase::PARAM_ISMULTI_LIMIT1] )
|| isset( $config[ApiBase::PARAM_ISMULTI_LIMIT2] )
) {
$this->assertTrue( !empty( $config[ApiBase::PARAM_ISMULTI] ), $param
$config[ApiBase::PARAM_ISMULTI_LIMIT2], $param
. 'PARAM_ISMULTI limit cannot be smaller for users with apihighlimits rights' );
}
+ if ( isset( $config[ApiBase::PARAM_MAX_BYTES] )
+ || isset( $config[ApiBase::PARAM_MAX_CHARS] )
+ ) {
+ $default = isset( $config[ApiBase::PARAM_DFLT] ) ? $config[ApiBase::PARAM_DFLT] : null;
+ $type = isset( $config[ApiBase::PARAM_TYPE] ) ? $config[ApiBase::PARAM_TYPE]
+ : gettype( $default );
+ $this->assertContains( $type, [ 'NULL', 'string', 'text', 'password' ],
+ 'PARAM_MAX_BYTES/CHARS is only supported for string-like types' );
+ }
}
}
}