}
try {
- $content = ContentHandler::makeContent( $text, $this->getTitle() );
+ $content = ContentHandler::makeContent( $text, $titleObj );
} catch ( MWContentSerializationException $ex ) {
$this->dieWithException( $ex, [
'wrap' => ApiMessage::create( 'apierror-contentserializationexception', 'parseerror' )
return;
}
if ( !$status->getErrors() ) {
- $status->fatal( 'hookaborted' );
+ // This appears to be unreachable right now, because all
+ // code paths will set an error. Could change, though.
+ $status->fatal( 'hookaborted' ); //@codeCoverageIgnore
}
$this->dieStatus( $status );
+ // These two cases will normally have been caught earlier, and will
+ // only occur if something blocks the user between the earlier
+ // check and the check in EditPage (presumably a hook). It's not
+ // obvious that this is even possible.
+ // @codeCoverageIgnoreStart
case EditPage::AS_BLOCKED_PAGE_FOR_USER:
$this->dieWithError(
'apierror-blocked',
case EditPage::AS_READ_ONLY_PAGE:
$this->dieReadOnly();
+ // @codeCoverageIgnoreEnd
case EditPage::AS_SUCCESS_NEW_ARTICLE:
$r['new'] = true;
$status->fatal( 'apierror-noimageredirect-anon' );
break;
case EditPage::AS_IMAGE_REDIRECT_LOGGED:
- $status->fatal( 'apierror-noimageredirect-logged' );
+ $status->fatal( 'apierror-noimageredirect' );
break;
case EditPage::AS_CONTENT_TOO_BIG:
case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
// Currently shouldn't be needed, but here in case
// hooks use them without setting appropriate
// errors on the status.
+ // @codeCoverageIgnoreStart
case EditPage::AS_SPAM_ERROR:
$status->fatal( 'apierror-spamdetected', $result['spam'] );
break;
wfWarn( __METHOD__ . ": Unknown EditPage code {$status->value} with no message" );
$status->fatal( 'apierror-unknownerror-editpage', $status->value );
break;
+ // @codeCoverageIgnoreEnd
}
}
$this->dieStatus( $status );
- break;
}
$apiResult->addValue( null, $this->getModuleName(), $r );
}
ApiBase::PARAM_TYPE => 'text',
],
'undo' => [
- ApiBase::PARAM_TYPE => 'integer'
+ ApiBase::PARAM_TYPE => 'integer',
+ ApiBase::PARAM_MIN => 0,
+ ApiBase::PARAM_RANGE_ENFORCE => true,
],
'undoafter' => [
- ApiBase::PARAM_TYPE => 'integer'
+ ApiBase::PARAM_TYPE => 'integer',
+ ApiBase::PARAM_MIN => 0,
+ ApiBase::PARAM_RANGE_ENFORCE => true,
],
'redirect' => [
ApiBase::PARAM_TYPE => 'boolean',