[HtmlOutputRendererHelper] Remove use of ParsoidOutputAccess::parseUncacheable

This removes the last use of ParsoidOutputAccess in core, allowing it
to be deprecated and eventually removed.

Bug: T367074
Bug: T317018
Change-Id: Ica2c880e2e7c2b126aaea66a3e4be460b3f2234f
This commit is contained in:
C. Scott Ananian 2024-05-16 16:42:16 -04:00
parent 6340a6f1f2
commit 1a1ac6a82d
9 changed files with 135 additions and 153 deletions

View file

@ -40,7 +40,7 @@ use MediaWiki\Parser\ParserOutput;
use MediaWiki\Parser\Parsoid\Config\SiteConfig as ParsoidSiteConfig;
use MediaWiki\Parser\Parsoid\HtmlTransformFactory;
use MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
use MediaWiki\Parser\Parsoid\ParsoidParserFactory;
use MediaWiki\Permissions\Authority;
use MediaWiki\Rest\Handler;
use MediaWiki\Rest\HttpException;
@ -129,12 +129,12 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
private bool $lenientRevHandling = false;
/**
* Flags to be passed as $options to ParsoidOutputAccess::getParserOutput,
* Flags to be passed as $options to ParserOutputAccess::getParserOutput,
* to control parser cache access.
*
* @var int Use ParsoidOutputAccess::OPT_*
* @var int Use ParserOutputAccess::OPT_*
*/
private $parsoidOutputAccessOptions = 0;
private $parserOutputAccessOptions = 0;
/**
* @see the $options parameter on Parsoid::wikitext2html
@ -152,7 +152,6 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
private ParsoidOutputStash $parsoidOutputStash;
private IBufferingStatsdDataFactory $stats;
private ParsoidOutputAccess $parsoidOutputAccess;
private ParserOutputAccess $parserOutputAccess;
private PageLookup $pageLookup;
private RevisionLookup $revisionLookup;
@ -160,15 +159,16 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
private HtmlTransformFactory $htmlTransformFactory;
private IContentHandlerFactory $contentHandlerFactory;
private LanguageFactory $languageFactory;
private ParsoidParserFactory $parsoidParserFactory;
public function __construct(
ParsoidOutputStash $parsoidOutputStash,
StatsdDataFactoryInterface $statsDataFactory,
ParsoidOutputAccess $parsoidOutputAccess,
ParserOutputAccess $parserOutputAccess,
PageLookup $pageLookup,
RevisionLookup $revisionLookup,
ParsoidSiteConfig $parsoidSiteConfig,
ParsoidParserFactory $parsoidParserFactory,
HtmlTransformFactory $htmlTransformFactory,
IContentHandlerFactory $contentHandlerFactory,
LanguageFactory $languageFactory,
@ -176,11 +176,11 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
) {
$this->parsoidOutputStash = $parsoidOutputStash;
$this->stats = $statsDataFactory;
$this->parsoidOutputAccess = $parsoidOutputAccess;
$this->parserOutputAccess = $parserOutputAccess;
$this->pageLookup = $pageLookup;
$this->revisionLookup = $revisionLookup;
$this->parsoidSiteConfig = $parsoidSiteConfig;
$this->parsoidParserFactory = $parsoidParserFactory;
$this->htmlTransformFactory = $htmlTransformFactory;
$this->contentHandlerFactory = $contentHandlerFactory;
$this->languageFactory = $languageFactory;
@ -266,7 +266,7 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
* @param bool $write Whether we should cache output after parsing
*/
public function setUseParserCache( bool $read, bool $write ) {
$this->parsoidOutputAccessOptions =
$this->parserOutputAccessOptions =
( $read ? 0 : ParserOutputAccess::OPT_FORCE_PARSE ) |
( $write ? 0 : ParserOutputAccess::OPT_NO_UPDATE_CACHE );
}
@ -759,7 +759,7 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
* @return Status
*/
private function getParserOutputInternal( ParserOptions $parserOptions ): Status {
// NOTE: ParsoidOutputAccess::getParserOutput() should be used for revisions
// NOTE: ParserOutputAccess::getParserOutput() should be used for revisions
// that comes from the database. Either this revision is null to indicate
// the current revision or the revision must have an ID.
// If we have a revision and the ID is 0 or null, then it's a fake revision
@ -775,14 +775,19 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
// 'view' flavor. In that case, we would want to use PoolCounterWork,
// either directly or through ParserOutputAccess.
if ( $this->isCacheable ) {
$flags = $this->parsoidOutputAccessOptions;
// Resolve revision
$page = $this->page;
$revision = $this->revisionOrId;
if ( $page === null ) {
throw new RevisionAccessException( "No page" );
} elseif ( !$page instanceof PageRecord ) {
$flags = $this->parserOutputAccessOptions;
// Resolve revision
$page = $this->page;
$revision = $this->revisionOrId;
if ( $page === null ) {
throw new RevisionAccessException( "No page" );
}
// NOTE: If we have a RevisionRecord already and this is
// not cacheable, just use it, there is no need to
// resolve $page to a PageRecord (and it may not be
// possible if the page doesn't exist).
if ( $this->isCacheable || !$revision instanceof RevisionRecord ) {
if ( !$page instanceof PageRecord ) {
$name = "$page";
$page = $this->pageLookup->getPageByReference( $page );
if ( !$page ) {
@ -828,6 +833,12 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
);
}
}
}
if ( $this->isCacheable ) {
// phan can't tell that we must have used the block above to
// resolve $page to a PageRecord if we've made it to this block.
'@phan-var PageRecord $page';
$mainSlot = $revision->getSlot( SlotRecord::MAIN );
$contentModel = $mainSlot->getModel();
if ( $this->parsoidSiteConfig->supportsContentModel( $contentModel ) ) {
@ -843,10 +854,10 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
$status = Status::newFatal( 'parsoid-resource-limit-exceeded', $e->getMessage() );
}
} else {
$status = $this->parsoidOutputAccess->parseUncacheable(
$this->page,
$status = $this->parseUncacheable(
$page,
$parserOptions,
$this->revisionOrId,
$revision,
$this->lenientRevHandling
);
@ -867,4 +878,33 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
return $status;
}
private function parseUncacheable(
PageIdentity $page,
ParserOptions $parserOpts,
RevisionRecord $revision,
bool $lenientRevHandling = false
): Status {
// Enforce caller expectation
$revId = $revision->getId();
if ( $revId !== 0 && $revId !== null ) {
return Status::newFatal( 'parsoid-revision-access',
"parseUncacheable should not be called for a real revision" );
}
try {
$parser = $this->parsoidParserFactory->create();
$parserOpts->setUseParsoid();
$parserOutput = $this->parsoidParserFactory->create()->parseFakeRevision(
$revision, $page, $parserOpts );
$parserOutput->updateCacheExpiry( 0 ); // Ensure this isn't accidentally cached
$status = Status::newGood( $parserOutput );
} catch ( RevisionAccessException $e ) {
return Status::newFatal( 'parsoid-revision-access', $e->getMessage() );
} catch ( ClientError $e ) {
$status = Status::newFatal( 'parsoid-client-error', $e->getMessage() );
} catch ( ResourceLimitExceededException $e ) {
$status = Status::newFatal( 'parsoid-resource-limit-exceeded', $e->getMessage() );
}
return $status;
}
}

View file

@ -13,7 +13,7 @@ use MediaWiki\Page\ParserOutputAccess;
use MediaWiki\Page\RedirectStore;
use MediaWiki\Parser\Parsoid\Config\SiteConfig as ParsoidSiteConfig;
use MediaWiki\Parser\Parsoid\HtmlTransformFactory;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
use MediaWiki\Parser\Parsoid\ParsoidParserFactory;
use MediaWiki\Rest\RequestInterface;
use MediaWiki\Rest\ResponseFactory;
use MediaWiki\Rest\Router;
@ -37,8 +37,8 @@ class PageRestHelperFactory {
private ParsoidOutputStash $parsoidOutputStash;
private StatsdDataFactoryInterface $stats;
private ParserOutputAccess $parserOutputAccess;
private ParsoidOutputAccess $parsoidOutputAccess;
private ParsoidSiteConfig $parsoidSiteConfig;
private ParsoidParserFactory $parsoidParserFactory;
private HtmlTransformFactory $htmlTransformFactory;
private IContentHandlerFactory $contentHandlerFactory;
private LanguageFactory $languageFactory;
@ -53,8 +53,8 @@ class PageRestHelperFactory {
* @param ParsoidOutputStash $parsoidOutputStash
* @param StatsdDataFactoryInterface $statsDataFactory
* @param ParserOutputAccess $parserOutputAccess
* @param ParsoidOutputAccess $parsoidOutputAccess
* @param ParsoidSiteConfig $parsoidSiteConfig
* @param ParsoidParserFactory $parsoidParserFactory
* @param HtmlTransformFactory $htmlTransformFactory
* @param IContentHandlerFactory $contentHandlerFactory
* @param LanguageFactory $languageFactory
@ -69,8 +69,8 @@ class PageRestHelperFactory {
ParsoidOutputStash $parsoidOutputStash,
StatsdDataFactoryInterface $statsDataFactory,
ParserOutputAccess $parserOutputAccess,
ParsoidOutputAccess $parsoidOutputAccess,
ParsoidSiteConfig $parsoidSiteConfig,
ParsoidParserFactory $parsoidParserFactory,
HtmlTransformFactory $htmlTransformFactory,
IContentHandlerFactory $contentHandlerFactory,
LanguageFactory $languageFactory,
@ -84,8 +84,8 @@ class PageRestHelperFactory {
$this->parsoidOutputStash = $parsoidOutputStash;
$this->stats = $statsDataFactory;
$this->parserOutputAccess = $parserOutputAccess;
$this->parsoidOutputAccess = $parsoidOutputAccess;
$this->parsoidSiteConfig = $parsoidSiteConfig;
$this->parsoidParserFactory = $parsoidParserFactory;
$this->htmlTransformFactory = $htmlTransformFactory;
$this->contentHandlerFactory = $contentHandlerFactory;
$this->languageFactory = $languageFactory;
@ -122,11 +122,11 @@ class PageRestHelperFactory {
return new HtmlOutputRendererHelper(
$this->parsoidOutputStash,
$this->stats,
$this->parsoidOutputAccess,
$this->parserOutputAccess,
$this->pageLookup,
$this->revisionLookup,
$this->parsoidSiteConfig,
$this->parsoidParserFactory,
$this->htmlTransformFactory,
$this->contentHandlerFactory,
$this->languageFactory,

View file

@ -1448,8 +1448,8 @@ return [
$services->getParsoidOutputStash(),
$services->getStatsdDataFactory(),
$services->getParserOutputAccess(),
$services->getParsoidOutputAccess(),
$services->getParsoidSiteConfig(),
$services->getParsoidParserFactory(),
$services->getHtmlTransformFactory(),
$services->getContentHandlerFactory(),
$services->getLanguageFactory(),

View file

@ -91,11 +91,11 @@ class CompareLanguageConverterOutput extends Maintenance {
$helper = new HtmlOutputRendererHelper(
$services->getParsoidOutputStash(),
new NullStatsdDataFactory(),
$services->getParsoidOutputAccess(),
$services->getParserOutputAccess(),
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$services->getParsoidParserFactory(),
$services->getHtmlTransformFactory(),
$services->getContentHandlerFactory(),
$services->getLanguageFactory()

View file

@ -6,7 +6,6 @@ use MediaWiki\MainConfigSchema;
use MediaWiki\Message\Message;
use MediaWiki\Page\ParserOutputAccess;
use MediaWiki\Parser\ParserOutput;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
use MediaWiki\Status\Status;
use MediaWiki\Title\Title;
use MediaWiki\User\User;
@ -154,10 +153,7 @@ class ArticleTest extends \MediaWikiIntegrationTestCase {
$parserOutputAccess->method( 'getCachedParserOutput' )
->willReturn( new ParserOutput( 'Kittens' ) );
$parsoidOutputAccess = $this->createNoOpMock( ParsoidOutputAccess::class );
$this->setService( 'ParserOutputAccess', $parserOutputAccess );
$this->setService( 'ParsoidOutputAccess', $parsoidOutputAccess );
$article = $this->newArticle( $title );
$article->view();

View file

@ -14,13 +14,13 @@ use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageIdentity;
use MediaWiki\Page\PageIdentityValue;
use MediaWiki\Page\PageRecord;
use MediaWiki\Page\PageReference;
use MediaWiki\Page\ParserOutputAccess;
use MediaWiki\Parser\ParserCacheFactory;
use MediaWiki\Parser\ParserOutput;
use MediaWiki\Parser\Parsoid\HtmlTransformFactory;
use MediaWiki\Parser\Parsoid\LanguageVariantConverter;
use MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
use MediaWiki\Parser\Parsoid\ParsoidParser;
use MediaWiki\Parser\Parsoid\ParsoidParserFactory;
use MediaWiki\Parser\RevisionOutputCache;
@ -127,57 +127,6 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
return $access;
}
/**
* @return MockObject|ParsoidOutputAccess
*/
public function newMockParsoidOutputAccess(): ParsoidOutputAccess {
$expectedCalls = [
'getParserOutput' => null,
'parseUncacheable' => null,
];
$parsoid = $this->createNoOpMock( ParsoidOutputAccess::class, array_keys( $expectedCalls ) );
$parsoid->expects( $this->exactlyOrAny( $expectedCalls[ 'getParserOutput' ] ) )
->method( 'getParserOutput' )
->willReturnCallback( function (
PageRecord $page,
ParserOptions $parserOpts,
$rev = null,
int $options = 0
) {
$pout = $this->makeParserOutput(
$parserOpts,
$this->getMockHtml( $rev ),
$rev,
$page
); // will use fake time
return Status::newGood( $pout );
} );
$parsoid->expects( $this->exactlyOrAny( $expectedCalls[ 'parseUncacheable' ] ) )
->method( 'parseUncacheable' )
->willReturnCallback( function (
PageIdentity $page,
ParserOptions $parserOpts,
$rev,
bool $lenientRevHandling
) {
$html = $this->getMockHtml( $rev );
$pout = $this->makeParserOutput(
$parserOpts,
$html,
$rev,
$page
);
return Status::newGood( $pout );
} );
return $parsoid;
}
private function getMockHtml( $rev ) {
if ( $rev instanceof RevisionRecord ) {
$html = '<p>' . $rev->getContent( SlotRecord::MAIN )->getText() . '</p>';
@ -286,13 +235,13 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
$helper = new HtmlOutputRendererHelper(
$stash,
new NullStatsdDataFactory(),
$options['ParsoidOutputAccess'] ?? $this->newMockParsoidOutputAccess(),
$options['ParserOutputAccess'] ?? $this->newMockParserOutputAccess(
$options['expectedHtml'] ?? null
),
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$options['ParsoidParserFactory'] ?? $services->getParsoidParserFactory(),
$options['HtmlTransformFactory'] ?? $services->getHtmlTransformFactory(),
$services->getContentHandlerFactory(),
$services->getLanguageFactory()
@ -550,14 +499,22 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
public function testGetHtmlFragment() {
$page = $this->getExistingTestPage();
$helper = $this->newHelper();
$expectedHtml = '<html><body><section data-mw-section-id=0><p>Contents</p></section></body></html>';
$helper = $this->newHelper( [
'ParsoidParserFactory' => $this->newMockParsoidParserFactory( [
'expectedHtml' => $expectedHtml
] ),
'expectedHtml' => $expectedHtml,
] );
$helper->init( $page, self::PARAM_DEFAULTS, $this->newAuthority() );
$helper->setFlavor( 'fragment' );
$helper->setContentSource( 'Contents', CONTENT_MODEL_WIKITEXT );
$htmlresult = $helper->getHtml()->getRawText();
$this->assertStringContainsString( 'fragment', $helper->getETag() );
$this->assertStringContainsString( self::MOCK_HTML, $htmlresult );
$this->assertStringContainsString( '<p>Contents</p>', $htmlresult );
$this->assertStringNotContainsString( "<body", $htmlresult );
$this->assertStringNotContainsString( "<section", $htmlresult );
}
@ -582,7 +539,7 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
/**
* @dataProvider provideRevisionReferences()
*/
public function testEtagLastModified( $revRef ) {
public function testETagLastModified( $revRef ) {
[ $page, $revisions ] = $this->getExistingPageWithRevisions( __METHOD__ );
$rev = $revRef ? $revisions[ $revRef ] : null;
@ -634,28 +591,31 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
/**
* @covers \MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper::init
* @covers \MediaWiki\Parser\Parsoid\ParsoidOutputAccess::parseUncacheable
* @covers \MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper::parseUncacheable
*/
public function testEtagLastModifiedWithPageIdentity() {
public function testETagLastModifiedWithPageIdentity() {
[ $fakePage, $fakeRevision ] = $this->getNonExistingPageWithFakeRevision( __METHOD__ );
$poa = $this->createMock( ParsoidOutputAccess::class );
$poa->expects( $this->once() )
->method( 'parseUncacheable' )
$pp = $this->createMock( ParsoidParser::class );
$pp->expects( $this->once() )
->method( 'parseFakeRevision' )
->willReturnCallback( function (
PageIdentity $page,
ParserOptions $parserOpts,
$rev,
bool $lenientRevHandling
RevisionRecord $rev,
PageReference $page,
ParserOptions $parserOpts
) use ( $fakePage, $fakeRevision ) {
self::assertSame( $page, $fakePage, '$page and $fakePage should be the same' );
self::assertSame( $rev, $fakeRevision, '$rev and $fakeRevision should be the same' );
$html = $this->getMockHtml( $rev );
$pout = $this->makeParserOutput( $parserOpts, $html, $rev, $page );
return Status::newGood( $pout );
return $pout;
} );
$options['ParsoidParser'] = $pp;
$options['ParsoidParserFactory'] = $this->newMockParsoidParserFactory(
$options
);
$helper = $this->newHelper( [ 'ParsoidOutputAccess' => $poa ] );
$helper = $this->newHelper( $options );
$helper->init( $fakePage, self::PARAM_DEFAULTS, $this->newAuthority() );
$helper->setRevision( $fakeRevision );
@ -707,8 +667,13 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
$cache = new HashBagOStuff();
// First, test it works if nothing was cached yet.
$helper = $this->newHelper( [ 'cache' => $cache ] );
$helper = $this->newHelper( [
'cache' => $cache,
] );
$helper->init( $page, $params + self::PARAM_DEFAULTS, $this->newAuthority() );
if ( ( $params['flavor'] ?? null ) === 'fragment' ) {
$helper->setContentSource( "fragment test", CONTENT_MODEL_WIKITEXT );
}
$etag = $helper->getETag( $mode );
$etag = trim( $etag, '"' );
@ -814,30 +779,46 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
];
}
private function resetServicesWithMockedParsoid( ?Parsoid $mockParsoid = null ): void {
$services = $this->getServiceContainer();
// Init mock Parsoid object
if ( !$mockParsoid ) {
$mockParsoid = $this->createNoOpMock( Parsoid::class, [ 'wikitext2html' ] );
$mockParsoid->method( 'wikitext2html' )
->willReturn( new PageBundle( 'This is HTML' ) );
private function newMockParsoidParserFactory( array $options = [] ) {
if ( isset( $options['Parsoid'] ) ) {
$mockParsoid = $options['Parsoid'];
} else {
$mockParsoid = $this->createNoOpMock( Parsoid::class, [
'wikitext2html',
] );
$mockParsoid
->method( 'wikitext2html' )
->willReturn( new PageBundle(
$options['expectedHtml'] ?? 'This is HTML'
) );
}
// Install it in the ParsoidParser object
$parsoidParser = new ParsoidParser(
$mockParsoid,
$services->getParsoidPageConfigFactory(),
$services->getLanguageConverterFactory(),
$services->getParserFactory(),
$services->getGlobalIdGenerator()
);
if ( isset( $options['ParsoidParser'] ) ) {
$parsoidParser = $options['ParsoidParser'];
} else {
$services = $this->getServiceContainer();
$parsoidParser = new ParsoidParser(
$mockParsoid,
$services->getParsoidPageConfigFactory(),
$services->getLanguageConverterFactory(),
$services->getParserFactory(),
$services->getGlobalIdGenerator()
);
}
// Create a mock Parsoid factory that returns the ParsoidParser object
// with the mocked Parsoid object.
$mockParsoidParserFactory = $this->createNoOpMock( ParsoidParserFactory::class, [ 'create' ] );
$mockParsoidParserFactory->method( 'create' )->willReturn( $parsoidParser );
return $mockParsoidParserFactory;
}
private function resetServicesWithMockedParsoid( ?Parsoid $mockParsoid = null ): void {
$services = $this->getServiceContainer();
$mockParsoidParserFactory = $this->newMockParsoidParserFactory( [
'Parsoid' => $mockParsoid,
] );
$this->setService( 'ParsoidParserFactory', $mockParsoidParserFactory );
}
@ -881,18 +862,8 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
$services->getWikiPageFactory(),
$services->getTitleFormatter()
);
$parsoidOutputAccess = new ParsoidOutputAccess(
$services->getParsoidParserFactory(),
$parserOutputAccess,
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$services->getContentHandlerFactory()
);
return [
'ParserOutputAccess' => $parserOutputAccess,
'ParsoidOutputAccess' => $parsoidOutputAccess,
];
}
@ -975,17 +946,12 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
) {
$page = $this->getExistingTestPage( __METHOD__ );
$parsoidAccess = $this->createNoOpMock( ParsoidOutputAccess::class, [ 'getParserOutput' ] );
$parsoidAccess->method( 'getParserOutput' )
->willReturn( $parserOutputStatus );
$parserAccess = $this->createNoOpMock( ParserOutputAccess::class, [ 'getParserOutput' ] );
$parserAccess->method( 'getParserOutput' )
->willReturn( $parserOutputStatus );
$helper = $this->newHelper( [
'ParserOutputAccess' => $parserAccess,
'ParsoidOutputAccess' => $parsoidAccess,
] );
$helper->init( $page, self::PARAM_DEFAULTS, $this->newAuthority() );

View file

@ -59,7 +59,7 @@ class PageHTMLHandlerTest extends MediaWikiIntegrationTestCase {
} else {
// ParserOutputAccess has a localCache which can return stale content.
// Resetting ensures that ParsoidCachePrewarmJob gets a fresh copy
// of ParserOutputAccess and ParsoidOutputAccess without these problems!
// of ParserOutputAccess without these problems!
$this->resetServices();
}

View file

@ -7,7 +7,6 @@ use MediaWiki\Config\ServiceOptions;
use MediaWiki\Deferred\DeferredUpdates;
use MediaWiki\MainConfigNames;
use MediaWiki\MainConfigSchema;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
use MediaWiki\Parser\Parsoid\ParsoidParser;
use MediaWiki\Parser\Parsoid\ParsoidParserFactory;
use MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper;
@ -62,15 +61,6 @@ class RevisionHTMLHandlerTest extends MediaWikiIntegrationTestCase {
MainConfigSchema::getDefaultValue( MainConfigNames::ParsoidCacheConfig )
];
$parsoidOutputAccess = new ParsoidOutputAccess(
$services->getParsoidParserFactory(),
$services->getParserOutputAccess(),
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$services->getContentHandlerFactory()
);
$helperFactory = $this->createNoOpMock(
PageRestHelperFactory::class,
[ 'newRevisionContentHelper', 'newHtmlOutputRendererHelper' ]
@ -88,11 +78,11 @@ class RevisionHTMLHandlerTest extends MediaWikiIntegrationTestCase {
->willReturn( new HtmlOutputRendererHelper(
$this->getParsoidOutputStash(),
$services->getStatsdDataFactory(),
$parsoidOutputAccess,
$services->getParserOutputAccess(),
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$services->getParsoidParserFactory(),
$services->getHtmlTransformFactory(),
$services->getContentHandlerFactory(),
$services->getLanguageFactory()

View file

@ -7,7 +7,6 @@ use FileRepo;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\MainConfigNames;
use MediaWiki\MainConfigSchema;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
use MediaWiki\Parser\Parsoid\ParsoidParser;
use MediaWiki\Parser\Parsoid\ParsoidParserFactory;
use MediaWiki\Rest\Handler\Helper\HtmlMessageOutputHelper;
@ -101,15 +100,6 @@ trait PageHandlerTestTrait {
MainConfigSchema::getDefaultValue( MainConfigNames::ParsoidCacheConfig )
];
$parsoidOutputAccess = new ParsoidOutputAccess(
$services->getParsoidParserFactory(),
$services->getParserOutputAccess(),
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$services->getContentHandlerFactory()
);
$helperFactory = $this->createNoOpMock(
PageRestHelperFactory::class,
[ 'newPageContentHelper', 'newHtmlOutputRendererHelper', 'newHtmlMessageOutputHelper', 'newPageRedirectHelper' ]
@ -129,11 +119,11 @@ trait PageHandlerTestTrait {
new HtmlOutputRendererHelper(
$parsoidOutputStash,
$services->getStatsdDataFactory(),
$parsoidOutputAccess,
$services->getParserOutputAccess(),
$services->getPageStore(),
$services->getRevisionLookup(),
$services->getParsoidSiteConfig(),
$services->getParsoidParserFactory(),
$services->getHtmlTransformFactory(),
$services->getContentHandlerFactory(),
$services->getLanguageFactory()