<?php
+use MediaWiki\Block\DatabaseBlock;
+use MediaWiki\MediaWikiServices;
use Wikimedia\TestingAccessWrapper;
/**
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => 'namespace',
],
- MWNamespace::getValidNamespaces(),
+ MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces(),
[],
],
// PARAM_ALL is ignored with namespace types.
ApiBase::PARAM_TYPE => 'namespace',
ApiBase::PARAM_ALL => false,
],
- MWNamespace::getValidNamespaces(),
+ MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces(),
[],
],
'Namespace with wildcard "x"' => [
[],
[ 'internalmode' => false ],
],
- 'Limit with parseLimits false' => [
+ 'Limit with parseLimits false (numeric)' => [
'100',
[ ApiBase::PARAM_TYPE => 'limit' ],
- '100',
+ 100,
+ [],
+ [ 'parseLimits' => false ],
+ ],
+ 'Limit with parseLimits false (max)' => [
+ 'max',
+ [ ApiBase::PARAM_TYPE => 'limit' ],
+ 'max',
+ [],
+ [ 'parseLimits' => false ],
+ ],
+ 'Limit with parseLimits false (invalid)' => [
+ 'kitten',
+ [ ApiBase::PARAM_TYPE => 'limit' ],
+ 0,
[],
[ 'parseLimits' => false ],
],
[
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MAX2 => 10,
- ApiBase::PARAM_ISMULTI => true,
],
new MWException(
'Internal error in ApiBase::getParameterFromSettings: ' .
[
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MAX => 10,
- ApiBase::PARAM_ISMULTI => true,
],
new MWException(
'Internal error in ApiBase::getParameterFromSettings: ' .
// Has a blocked $user, so special block handling
$user = $this->getMutableTestUser()->getUser();
- $block = new \Block( [
+ $block = new DatabaseBlock( [
'address' => $user->getName(),
'user' => $user->getID(),
'by' => $this->getTestSysop()->getUser()->getId(),
$userInfoTrait = TestingAccessWrapper::newFromObject(
$this->getMockForTrait( ApiBlockInfoTrait::class )
);
- $blockinfo = [ 'blockinfo' => $userInfoTrait->getBlockInfo( $block ) ];
+ $blockinfo = [ 'blockinfo' => $userInfoTrait->getBlockDetails( $block ) ];
$expect = Status::newGood();
$expect->fatal( ApiMessage::create( 'apierror-blocked', 'blocked', $blockinfo ) );
// Has a blocked $user, so special block handling
$user = $this->getMutableTestUser()->getUser();
- $block = new \Block( [
+ $block = new DatabaseBlock( [
'address' => $user->getName(),
'user' => $user->getID(),
'by' => $this->getTestSysop()->getUser()->getId(),
$userInfoTrait = TestingAccessWrapper::newFromObject(
$this->getObjectForTrait( ApiBlockInfoTrait::class )
);
- $blockinfo = [ 'blockinfo' => $userInfoTrait->getBlockInfo( $block ) ];
+ $blockinfo = [ 'blockinfo' => $userInfoTrait->getBlockDetails( $block ) ];
$expect = Status::newGood();
$expect->fatal( ApiMessage::create( 'apierror-blocked', 'blocked', $blockinfo ) );
}
$status = StatusValue::newGood();
- $status->setOk( false );
+ $status->setOK( false );
try {
$mock->dieStatus( $status );
$this->fail( 'Expected exception not thrown' );