Merge "Revert "tests: Special page constructor are not allow to call getContext""

This commit is contained in:
jenkins-bot 2021-12-03 18:43:06 +00:00 committed by Gerrit Code Review
commit 676747b51f

View file

@ -3,7 +3,6 @@
use MediaWiki\MediaWikiServices;
use MediaWiki\Permissions\UltimateAuthority;
use MediaWiki\User\UserIdentityValue;
use Wikimedia\TestingAccessWrapper;
/**
* Test that runs against all registered special pages to make sure that regular
@ -41,16 +40,6 @@ class SpecialPageFatalTest extends MediaWikiIntegrationTestCase {
$this->markTestSkipped( "Could not create special page $name" );
}
// Assert that the global context is not used,
// can have side effects on Special:SpecialPages
$assertPage = TestingAccessWrapper::newFromObject( $page );
if ( $assertPage->mContext !== null ) {
// Does not call assertNull, because that prints the whole object
// and building message is also expensive
$this->fail( get_class( $page ) . '::__construct is not safe to call SpecialPage::getContext()' .
' (possible indirectly by other get*() functions)' );
}
$executor = new SpecialPageExecutor();
$authority = new UltimateAuthority( new UserIdentityValue( 0, 'UTSysop' ) );