3 namespace MediaWiki\Tests\Api
;
5 use MediaWiki\Context\DerivativeContext
;
6 use MediaWiki\Context\RequestContext
;
7 use MediaWiki\Permissions\Authority
;
8 use MediaWiki\Request\WebRequest
;
10 class ApiTestContext
extends RequestContext
{
13 * Returns a DerivativeContext with the request variables in place
15 * @param WebRequest $request WebRequest request object including parameters and session
16 * @param Authority|null $performer
17 * @return DerivativeContext
19 public function newTestContext( WebRequest
$request, ?Authority
$performer = null ) {
20 $context = new DerivativeContext( $this );
21 $context->setRequest( $request );
22 if ( $performer !== null ) {
23 $context->setAuthority( $performer );
30 /** @deprecated class alias since 1.42 */
31 class_alias( ApiTestContext
::class, 'ApiTestContext' );