Replace deprecated calls ParserOptions::newCanonical( 'canonical' )
This is a quick find & replace of calls to the deprecated method ParserOptions::newCanonical() when the context is the string literal 'canonical'. This can be safely replaced by called newFromAnon(). Change-Id: If7bb68459b11e0c5f5de188f10fdae85ad1a78bf
This commit is contained in:
parent
b654f3827b
commit
d01e3ed739
18 changed files with 123 additions and 123 deletions
|
|
@ -366,7 +366,7 @@ class ParsoidHTMLHelper {
|
|||
}
|
||||
|
||||
$revId = $this->revision ? $this->revision->getId() : $this->page->getLatest();
|
||||
$parserOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$parserOptions = ParserOptions::newFromAnon();
|
||||
|
||||
$isOld = $revId !== $this->page->getLatest();
|
||||
|
||||
|
|
|
|||
|
|
@ -553,7 +553,7 @@ abstract class AbstractContent implements Content {
|
|||
|
||||
if ( $detectGPODeprecatedOverride || $detectFPODeprecatedOverride ) {
|
||||
if ( $options === null ) {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
}
|
||||
|
||||
$po = new ParserOutput();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class ContentParseParams {
|
|||
bool $generateHtml = true
|
||||
) {
|
||||
$this->page = $page;
|
||||
$this->parserOptions = $parserOptions ?? ParserOptions::newCanonical( 'canonical' );
|
||||
$this->parserOptions = $parserOptions ?? ParserOptions::newFromAnon();
|
||||
$this->revId = $revId;
|
||||
$this->generateHtml = $generateHtml;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1285,7 +1285,7 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
}
|
||||
|
||||
if ( !$parserOptions ) {
|
||||
$parserOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$parserOptions = ParserOptions::newFromAnon();
|
||||
}
|
||||
|
||||
$options = $noCache ? ParserOutputAccess::OPT_NO_CACHE : 0;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class CLIParser extends Maintenance {
|
|||
* @return ParserOutput
|
||||
*/
|
||||
protected function parse( $wikitext ) {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setOption( 'enableLimitReport', false );
|
||||
return $this->parser->parse(
|
||||
$wikitext,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
RevisionStoreRecord::class,
|
||||
PageIdentityValue::localIdentity( 0, NS_MAIN, __METHOD__ )
|
||||
);
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
|
||||
$this->expectException( InvalidArgumentException::class );
|
||||
$this->expectExceptionMessage(
|
||||
|
|
@ -174,7 +174,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
PageIdentityValue::localIdentity( 0, NS_MAIN, 'RenderTestPage' )
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -206,7 +206,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev = $this->getMockRevision( RevisionStoreRecord::class, $title, null, 0, $content );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -225,7 +225,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
21
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -255,7 +255,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
11
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -285,7 +285,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
11
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -316,7 +316,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
RevisionRecord::DELETED_TEXT
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -336,7 +336,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
RevisionRecord::DELETED_TEXT
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -370,7 +370,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
RevisionRecord::DELETED_TEXT
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -408,7 +408,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
0,
|
||||
$content );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -454,7 +454,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -492,7 +492,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
RevisionRecord::DELETED_TEXT
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -526,7 +526,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
PageIdentityValue::localIdentity( 3, NS_MAIN, 'RenderTestPage' )
|
||||
);
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -570,7 +570,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
$rev->setContent( SlotRecord::MAIN, $content );
|
||||
$rev->setContent( 'aux', $content );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -598,7 +598,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
$rev->setContent( 'aux', new WikitextContent( '[[Goats]]' ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -643,7 +643,7 @@ class RenderedRevisionTest extends MediaWikiIntegrationTestCase {
|
|||
$rev->setId( 123 );
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( 'FooBar' ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = new RenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision( $rev, $options );
|
||||
|
||||
$this->assertFalse( $rr->isContentDeleted(), 'isContentDeleted' );
|
||||
|
|
@ -168,7 +168,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision( $rev, $options );
|
||||
|
||||
$this->assertFalse( $rr->isContentDeleted(), 'isContentDeleted' );
|
||||
|
|
@ -203,7 +203,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision( $rev, $options, null, [ 'use-master' => true ] );
|
||||
|
||||
$this->assertFalse( $rr->isContentDeleted(), 'isContentDeleted' );
|
||||
|
|
@ -229,7 +229,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$output = new ParserOutput( 'cached text' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
@ -259,7 +259,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision( $rev, $options );
|
||||
|
||||
$this->assertFalse( $rr->isContentDeleted(), 'isContentDeleted' );
|
||||
|
|
@ -295,7 +295,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision( $rev, $options );
|
||||
|
||||
$this->assertNull( $rr, 'getRenderedRevision' );
|
||||
|
|
@ -319,7 +319,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$sysop = $this->mockRegisteredUltimateAuthority();
|
||||
$rr = $renderer->getRenderedRevision( $rev, $options, $sysop );
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ class RevisionRendererTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$rev->setContent( SlotRecord::MAIN, new WikitextContent( $text ) );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$rr = $renderer->getRenderedRevision(
|
||||
$rev,
|
||||
$options,
|
||||
|
|
|
|||
|
|
@ -992,7 +992,7 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$expected = strval( $callback( $rev ) );
|
||||
|
||||
$output = $page->getParserOutput( ParserOptions::newCanonical( 'canonical' ) );
|
||||
$output = $page->getParserOutput( ParserOptions::newFromAnon() );
|
||||
$html = $output->getText();
|
||||
$text = $rev->getContent( SlotRecord::MAIN )->serialize();
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ just a test"
|
|||
$wikitext = false;
|
||||
$redirectTarget = false;
|
||||
$content = $this->newContent( 'hello world.' );
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setRedirectTarget( $title );
|
||||
$contentRenderer->getParserOutput( $content, $title, null, $options );
|
||||
$this->assertEquals( 'hello world.', $wikitext,
|
||||
|
|
@ -323,7 +323,7 @@ just a test"
|
|||
$content = $this->newContent(
|
||||
"#REDIRECT [[TestRedirectParserOption/redir]]\nhello redirect."
|
||||
);
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$contentRenderer->getParserOutput( $content, $title, null, $options );
|
||||
$this->assertEquals(
|
||||
'hello redirect.',
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
|
||||
$this->assertRecentChangeByCategorization(
|
||||
$title,
|
||||
$wikiPage->getParserOutput( ParserOptions::newCanonical( 'canonical' ) ),
|
||||
$wikiPage->getParserOutput( ParserOptions::newFromAnon() ),
|
||||
Title::newFromText( 'Category:Foo' ),
|
||||
[ [ 'Foo', '[[:Testing]] added to category' ] ]
|
||||
);
|
||||
|
|
@ -323,7 +323,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
|
||||
$this->assertRecentChangeByCategorization(
|
||||
$title,
|
||||
$wikiPage->getParserOutput( ParserOptions::newCanonical( 'canonical' ) ),
|
||||
$wikiPage->getParserOutput( ParserOptions::newFromAnon() ),
|
||||
Title::newFromText( 'Category:Foo' ),
|
||||
[
|
||||
[ 'Foo', '[[:Testing]] added to category' ],
|
||||
|
|
@ -333,7 +333,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
|
||||
$this->assertRecentChangeByCategorization(
|
||||
$title,
|
||||
$wikiPage->getParserOutput( ParserOptions::newCanonical( 'canonical' ) ),
|
||||
$wikiPage->getParserOutput( ParserOptions::newFromAnon() ),
|
||||
Title::newFromText( 'Category:Bar' ),
|
||||
[
|
||||
[ 'Bar', '[[:Testing]] added to category' ],
|
||||
|
|
@ -365,7 +365,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
|
||||
$this->assertRecentChangeByCategorization(
|
||||
$templateTitle,
|
||||
$templatePage->getParserOutput( ParserOptions::newCanonical( 'canonical' ) ),
|
||||
$templatePage->getParserOutput( ParserOptions::newFromAnon() ),
|
||||
Title::newFromText( 'Baz' ),
|
||||
[]
|
||||
);
|
||||
|
|
@ -379,7 +379,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
|
||||
$this->assertRecentChangeByCategorization(
|
||||
$templateTitle,
|
||||
$templatePage->getParserOutput( ParserOptions::newCanonical( 'canonical' ) ),
|
||||
$templatePage->getParserOutput( ParserOptions::newFromAnon() ),
|
||||
Title::newFromText( 'Baz' ),
|
||||
[ [
|
||||
'Baz',
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
* @return ParserOptions
|
||||
*/
|
||||
private function getParserOptions() {
|
||||
return ParserOptions::newCanonical( 'canonical' );
|
||||
return ParserOptions::newFromAnon();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -228,7 +228,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
$parserCache = $this->getParserCache( new HashBagOStuff() );
|
||||
$access = $this->getParserOutputAccessWithCache( $parserCache );
|
||||
|
||||
$parserOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$parserOptions = ParserOptions::newFromAnon();
|
||||
$page = $this->getNonexistingTestPage( __METHOD__ );
|
||||
$this->editPage( $page, 'Hello \'\'World\'\'!' );
|
||||
|
||||
|
|
@ -334,10 +334,10 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
public function testLatestRevisionCacheSplit() {
|
||||
$access = $this->getParserOutputAccessWithCache();
|
||||
|
||||
$frenchOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$frenchOptions = ParserOptions::newFromAnon();
|
||||
$frenchOptions->setUserLang( 'fr' );
|
||||
|
||||
$tongaOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$tongaOptions = ParserOptions::newFromAnon();
|
||||
$tongaOptions->setUserLang( 'to' );
|
||||
|
||||
$page = $this->getNonexistingTestPage( __METHOD__ );
|
||||
|
|
@ -517,10 +517,10 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
|
|||
public function testOldRevisionCacheSplit() {
|
||||
$access = $this->getParserOutputAccessWithCache();
|
||||
|
||||
$frenchOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$frenchOptions = ParserOptions::newFromAnon();
|
||||
$frenchOptions->setUserLang( 'fr' );
|
||||
|
||||
$tongaOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$tongaOptions = ParserOptions::newFromAnon();
|
||||
$tongaOptions->setUserLang( 'to' );
|
||||
|
||||
$page = $this->getNonexistingTestPage( __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache();
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ), $this->cacheTime );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon(), $this->cacheTime );
|
||||
|
||||
$metadataFromCache = $cache->getMetadata( $this->page, ParserCache::USE_CURRENT_ONLY );
|
||||
$this->assertNotNull( $metadataFromCache );
|
||||
|
|
@ -151,7 +151,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
public function testGetMetadataExpired() {
|
||||
$cache = $this->createParserCache();
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ), $this->cacheTime );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon(), $this->cacheTime );
|
||||
|
||||
$this->page = $this->createPageRecord( [ 'page_touched' => $this->time + 10000 ] );
|
||||
$this->assertNull( $cache->getMetadata( $this->page, ParserCache::USE_CURRENT_ONLY ) );
|
||||
|
|
@ -169,7 +169,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
public function testGetMetadataOutdated() {
|
||||
$cache = $this->createParserCache();
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ), $this->cacheTime );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon(), $this->cacheTime );
|
||||
|
||||
$this->page = $this->createPageRecord( [ 'page_latest' => $this->page->getLatest() + 1 ] );
|
||||
$this->assertNull( $cache->getMetadata( $this->page, ParserCache::USE_CURRENT_ONLY ) );
|
||||
|
|
@ -187,12 +187,12 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
public function testMakeParserOutputKey() {
|
||||
$cache = $this->createParserCache();
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $this->getDummyUsedOptions()[0], 'value1' );
|
||||
$key1 = $cache->makeParserOutputKey( $this->page, $options1, $this->getDummyUsedOptions() );
|
||||
$this->assertNotNull( $key1 );
|
||||
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $this->getDummyUsedOptions()[0], 'value2' );
|
||||
$key2 = $cache->makeParserOutputKey( $this->page, $options2, $this->getDummyUsedOptions() );
|
||||
$this->assertNotNull( $key2 );
|
||||
|
|
@ -205,7 +205,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testGetEmpty() {
|
||||
$cache = $this->createParserCache();
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
|
||||
$this->assertFalse( $cache->get( $this->page, $options ) );
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $this->getDummyUsedOptions()[0], 'value1' );
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
|
|
@ -241,11 +241,11 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$optionName = $this->getDummyUsedOptions()[0];
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $optionName, 'value1' );
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $optionName, 'value2' );
|
||||
$savedOutput = $cache->get( $this->page, $options2 );
|
||||
$this->assertInstanceOf( ParserOutput::class, $savedOutput );
|
||||
|
|
@ -265,7 +265,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput->updateCacheExpiry( 0 );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
$this->assertFalse( $cache->get( $this->page, $options1 ) );
|
||||
|
|
@ -282,7 +282,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput->recordOption( 'wrapclass' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setOption( 'wrapclass', 'wrapwrap' );
|
||||
|
||||
$cache->save( $parserOutput, $this->page, $options, $this->cacheTime );
|
||||
|
|
@ -301,9 +301,9 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput->recordOption( 'wrapclass' );
|
||||
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ), $this->cacheTime );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon(), $this->cacheTime );
|
||||
|
||||
$otherOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$otherOptions = ParserOptions::newFromAnon();
|
||||
$otherOptions->setOption( 'wrapclass', 'wrapwrap' );
|
||||
|
||||
$this->assertFalse( $cache->get( $this->page, $otherOptions ) );
|
||||
|
|
@ -320,7 +320,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setOption( 'wrapclass', 'wrapwrap' );
|
||||
|
||||
$cache->save( $parserOutput, $this->page, $options, $this->cacheTime );
|
||||
|
|
@ -338,11 +338,11 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$optionName = $this->getDummyUsedOptions()[0];
|
||||
$parserOutput->recordOption( $optionName );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $optionName, 'value1' );
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $optionName, 'value2' );
|
||||
$this->assertFalse( $cache->get( $this->page, $options2 ) );
|
||||
}
|
||||
|
|
@ -357,7 +357,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput->updateCacheExpiry( 10 );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
MWTimestamp::setFakeTime( $this->time + 15 * 1000 );
|
||||
|
|
@ -380,14 +380,14 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOutput1 = new ParserOutput( 'TEST_TEXT1' );
|
||||
$parserOutput1->recordOption( $optionName );
|
||||
$parserOutput1->updateCacheExpiry( 10 );
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $optionName, 'value1' );
|
||||
$cache->save( $parserOutput1, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
$parserOutput2 = new ParserOutput( 'TEST_TEXT2' );
|
||||
$parserOutput2->recordOption( $optionName );
|
||||
$parserOutput2->updateCacheExpiry( 100500600 );
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $optionName, 'value2' );
|
||||
$cache->save( $parserOutput2, $this->page, $options2, $this->cacheTime );
|
||||
|
||||
|
|
@ -408,7 +408,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
$this->assertInstanceOf( ParserOutput::class,
|
||||
$cache->get( $this->page, $options1 ) );
|
||||
|
|
@ -432,14 +432,14 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOutput1 = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput1->recordOption( $optionName );
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $optionName, 'value1' );
|
||||
$cache->save( $parserOutput1, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
$this->page = $this->createPageRecord( [ 'page_latest' => $this->page->getLatest() + 1 ] );
|
||||
$parserOutput2 = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput2->recordOption( $optionName );
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $optionName, 'value2' );
|
||||
$cache->save( $parserOutput2, $this->page, $options2, $this->cacheTime );
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
$this->assertInstanceOf( ParserOutput::class,
|
||||
$cache->get( $this->page, $options1 ) );
|
||||
|
|
@ -473,7 +473,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testRejectedByHook() {
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setOption( $this->getDummyUsedOptions()[0], 'value1' );
|
||||
|
||||
$wikiPageMock = $this->createMock( WikiPage::class );
|
||||
|
|
@ -502,7 +502,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testParserCacheSaveCompleteHook() {
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setOption( $this->getDummyUsedOptions()[0], 'value1' );
|
||||
|
||||
$hookContainer = $this->createHookContainer( [
|
||||
|
|
@ -532,7 +532,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
->with( $mockPage )
|
||||
->willReturn( $wikiPageMock );
|
||||
$cache = $this->createParserCache( null, null, null, $wikiPageFactoryMock );
|
||||
$this->assertFalse( $cache->get( $mockPage, ParserOptions::newCanonical( 'canonical' ) ) );
|
||||
$this->assertFalse( $cache->get( $mockPage, ParserOptions::newFromAnon() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -544,7 +544,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$page = $this->createPageRecord( [
|
||||
'page_is_redirect' => true
|
||||
] );
|
||||
$this->assertFalse( $cache->get( $page, ParserOptions::newCanonical( 'canonical' ) ) );
|
||||
$this->assertFalse( $cache->get( $page, ParserOptions::newFromAnon() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -565,7 +565,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$this->createParserCache()->save(
|
||||
new ParserOutput( null ),
|
||||
$this->page,
|
||||
ParserOptions::newCanonical( 'canonical' )
|
||||
ParserOptions::newFromAnon()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -592,7 +592,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache( null, new HashBagOStuff() );
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
$outputKey = $cache->makeParserOutputKey(
|
||||
|
|
@ -620,7 +620,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createParserCache( null, $cacheStorage );
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->page, $options1, $this->cacheTime );
|
||||
|
||||
// Mess up the metadata
|
||||
|
|
@ -672,7 +672,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOutput1 = new ParserOutput( 'Lorem Ipsum' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput1, $this->page, $options, $this->cacheTime );
|
||||
|
||||
// emulate migration to JSON
|
||||
|
|
@ -700,7 +700,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
$parserOutput->setExtensionData( 'test', new User() );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ) );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon() );
|
||||
$this->assertArraySubmapSame(
|
||||
[ [ LogLevel::ERROR, 'Unable to serialize JSON' ] ],
|
||||
$testLogger->getBuffer()
|
||||
|
|
@ -718,7 +718,7 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cyclicArray = [ 'a' => 'b' ];
|
||||
$cyclicArray['c'] = &$cyclicArray;
|
||||
$parserOutput->setExtensionData( 'test', $cyclicArray );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ) );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon() );
|
||||
$this->assertArraySubmapSame(
|
||||
[ [ LogLevel::ERROR, 'Unable to serialize JSON' ] ],
|
||||
$testLogger->getBuffer()
|
||||
|
|
@ -736,9 +736,9 @@ class ParserCacheTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
$parserOutput->setText( $unicodeCharacter );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newCanonical( 'canonical' ) );
|
||||
$cache->save( $parserOutput, $this->page, ParserOptions::newFromAnon() );
|
||||
$json = $cache->getCacheStorage()->get(
|
||||
$cache->makeParserOutputKey( $this->page, ParserOptions::newCanonical( 'canonical' ) )
|
||||
$cache->makeParserOutputKey( $this->page, ParserOptions::newFromAnon() )
|
||||
);
|
||||
$this->assertStringNotContainsString( "\u003E", $json );
|
||||
$this->assertStringContainsString( $unicodeCharacter, $json );
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
$this->assertSame( $lang, $popt->getUserLangObj() );
|
||||
|
||||
// Passing 'canonical' uses an anon and $contLang, and ignores any passed $userLang
|
||||
$popt = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt = ParserOptions::newFromAnon();
|
||||
$this->assertTrue( $popt->getUserIdentity()->isAnon() );
|
||||
$this->assertSame( $contLang, $popt->getUserLangObj() );
|
||||
$popt = ParserOptions::newCanonical( 'canonical', $lang2 );
|
||||
|
|
@ -82,7 +82,7 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
* @param array|null $usedOptions
|
||||
*/
|
||||
public function testIsSafeToCache( bool $expect, array $options, array $usedOptions = null ) {
|
||||
$popt = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt = ParserOptions::newFromAnon();
|
||||
foreach ( $options as $name => $value ) {
|
||||
$popt->setOption( $name, $value );
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
$this->setMwGlobals( $globals );
|
||||
$this->setTemporaryHook( 'PageRenderingHash', $hookFunc );
|
||||
|
||||
$popt = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt = ParserOptions::newFromAnon();
|
||||
foreach ( $options as $name => $value ) {
|
||||
$popt->setOption( $name, $value );
|
||||
}
|
||||
|
|
@ -209,7 +209,7 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
|
||||
ParserOptions::clearStaticCache();
|
||||
|
||||
$popt = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt = ParserOptions::newFromAnon();
|
||||
$popt->registerWatcher( function () {
|
||||
$this->fail( 'Watcher should not have been called' );
|
||||
} );
|
||||
|
|
@ -233,7 +233,7 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
);
|
||||
|
||||
$po = ParserOptions::newCanonical( 'canonical' );
|
||||
$po = ParserOptions::newFromAnon();
|
||||
$this->assertSame( 'default!', $po->getOption( 'test_option' ) );
|
||||
$this->assertTrue( $loaded );
|
||||
$this->assertSame(
|
||||
|
|
@ -247,22 +247,22 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function testGetInvalidOption() {
|
||||
$popt = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt = ParserOptions::newFromAnon();
|
||||
$this->expectException( InvalidArgumentException::class );
|
||||
$this->expectExceptionMessage( "Unknown parser option bogus" );
|
||||
$popt->getOption( 'bogus' );
|
||||
}
|
||||
|
||||
public function testSetInvalidOption() {
|
||||
$popt = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt = ParserOptions::newFromAnon();
|
||||
$this->expectException( InvalidArgumentException::class );
|
||||
$this->expectExceptionMessage( "Unknown parser option bogus" );
|
||||
$popt->setOption( 'bogus', true );
|
||||
}
|
||||
|
||||
public function testMatches() {
|
||||
$popt1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt1 = ParserOptions::newFromAnon();
|
||||
$popt2 = ParserOptions::newFromAnon();
|
||||
$this->assertTrue( $popt1->matches( $popt2 ) );
|
||||
|
||||
$popt2->setInterfaceMessage( !$popt2->getInterfaceMessage() );
|
||||
|
|
@ -279,8 +279,8 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
);
|
||||
ParserOptions::clearStaticCache();
|
||||
|
||||
$popt1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt1 = ParserOptions::newFromAnon();
|
||||
$popt2 = ParserOptions::newFromAnon();
|
||||
$this->assertFalse( $popt1->matches( $popt2 ) );
|
||||
|
||||
ScopedCallback::consume( $reset );
|
||||
|
|
@ -291,8 +291,8 @@ class ParserOptionsTest extends MediaWikiLangTestCase {
|
|||
* because the lazy option from the hook in the previous test remains active.
|
||||
*/
|
||||
public function testTeardownClearedCache() {
|
||||
$popt1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$popt1 = ParserOptions::newFromAnon();
|
||||
$popt2 = ParserOptions::newFromAnon();
|
||||
$this->assertTrue( $popt1->matches( $popt2 ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,12 +115,12 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
public function testMakeParserOutputKey() {
|
||||
$cache = $this->createRevisionOutputCache();
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $this->getDummyUsedOptions()[0], 'value1' );
|
||||
$key1 = $cache->makeParserOutputKey( $this->revision, $options1, $this->getDummyUsedOptions() );
|
||||
$this->assertNotNull( $key1 );
|
||||
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $this->getDummyUsedOptions()[0], 'value2' );
|
||||
$key2 = $cache->makeParserOutputKey( $this->revision, $options2, $this->getDummyUsedOptions() );
|
||||
$this->assertNotNull( $key2 );
|
||||
|
|
@ -133,7 +133,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testGetEmpty() {
|
||||
$cache = $this->createRevisionOutputCache();
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
|
||||
$this->assertFalse( $cache->get( $this->revision, $options ) );
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $this->getDummyUsedOptions()[0], 'value1' );
|
||||
$cache->save( $parserOutput, $this->revision, $options1, $this->cacheTime );
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
$parserOutput->updateCacheExpiry( 0 );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->revision, $options1, $this->cacheTime );
|
||||
|
||||
$this->assertFalse( $cache->get( $this->revision, $options1 ) );
|
||||
|
|
@ -183,7 +183,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache( $store );
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->revision, $options, $this->cacheTime );
|
||||
|
||||
// determine cache epoch younger than cache time
|
||||
|
|
@ -206,7 +206,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache( $store );
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->revision, $options, $this->cacheTime );
|
||||
|
||||
// move the clock forward by 60 seconds
|
||||
|
|
@ -226,7 +226,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$options->setOption( 'wrapclass', 'wrapwrap' );
|
||||
|
||||
$cache->save( $parserOutput, $this->revision, $options, $this->cacheTime );
|
||||
|
|
@ -242,9 +242,9 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newCanonical( 'canonical' ), $this->cacheTime );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newFromAnon(), $this->cacheTime );
|
||||
|
||||
$otherOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$otherOptions = ParserOptions::newFromAnon();
|
||||
$otherOptions->setOption( 'wrapclass', 'wrapwrap' );
|
||||
|
||||
$this->assertFalse( $cache->get( $this->revision, $otherOptions ) );
|
||||
|
|
@ -261,11 +261,11 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$optionName = $this->getDummyUsedOptions()[0];
|
||||
$parserOutput->recordOption( $optionName );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$options1->setOption( $optionName, 'value1' );
|
||||
$cache->save( $parserOutput, $this->revision, $options1, $this->cacheTime );
|
||||
|
||||
$options2 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options2 = ParserOptions::newFromAnon();
|
||||
$options2->setOption( $optionName, 'value2' );
|
||||
$this->assertFalse( $cache->get( $this->revision, $options2 ) );
|
||||
}
|
||||
|
|
@ -278,7 +278,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$this->createRevisionOutputCache()->save(
|
||||
new ParserOutput( null ),
|
||||
$this->revision,
|
||||
ParserOptions::newCanonical( 'canonical' )
|
||||
ParserOptions::newFromAnon()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache();
|
||||
$parserOutput = new ParserOutput( 'TEST_TEXT' );
|
||||
|
||||
$options1 = ParserOptions::newCanonical( 'canonical' );
|
||||
$options1 = ParserOptions::newFromAnon();
|
||||
$cache->save( $parserOutput, $this->revision, $options1, $this->cacheTime );
|
||||
|
||||
$outputKey = $cache->makeParserOutputKey(
|
||||
|
|
@ -331,7 +331,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
$parserOutput->setExtensionData( 'test', new User() );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newCanonical( 'canonical' ) );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newFromAnon() );
|
||||
$this->assertArraySubmapSame(
|
||||
[ [ LogLevel::ERROR, 'Unable to serialize JSON' ] ],
|
||||
$testLogger->getBuffer()
|
||||
|
|
@ -349,7 +349,7 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cyclicArray = [ 'a' => 'b' ];
|
||||
$cyclicArray['c'] = &$cyclicArray;
|
||||
$parserOutput->setExtensionData( 'test', $cyclicArray );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newCanonical( 'canonical' ) );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newFromAnon() );
|
||||
$this->assertArraySubmapSame(
|
||||
[ [ LogLevel::ERROR, 'Unable to serialize JSON' ] ],
|
||||
$testLogger->getBuffer()
|
||||
|
|
@ -365,11 +365,11 @@ class RevisionOutputCacheTest extends MediaWikiIntegrationTestCase {
|
|||
$cache = $this->createRevisionOutputCache( new HashBagOStuff() );
|
||||
$parserOutput = $this->createDummyParserOutput();
|
||||
$parserOutput->setText( $unicodeCharacter );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newCanonical( 'canonical' ) );
|
||||
$cache->save( $parserOutput, $this->revision, ParserOptions::newFromAnon() );
|
||||
|
||||
$backend = TestingAccessWrapper::newFromObject( $cache )->cache;
|
||||
$json = $backend->get(
|
||||
$cache->makeParserOutputKey( $this->revision, ParserOptions::newCanonical( 'canonical' ) )
|
||||
$cache->makeParserOutputKey( $this->revision, ParserOptions::newFromAnon() )
|
||||
);
|
||||
$this->assertStringNotContainsString( "\u003E", $json );
|
||||
$this->assertStringContainsString( $unicodeCharacter, $json );
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class PoolWorkArticleViewCurrentTest extends PoolWorkArticleViewTest {
|
|||
$options = null
|
||||
) {
|
||||
if ( !$options ) {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
}
|
||||
|
||||
if ( !$rev ) {
|
||||
|
|
@ -69,7 +69,7 @@ class PoolWorkArticleViewCurrentTest extends PoolWorkArticleViewTest {
|
|||
}
|
||||
|
||||
public function testUpdateCachedOutput() {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
|
||||
$parserCache = $this->installParserCache();
|
||||
|
|
@ -91,7 +91,7 @@ class PoolWorkArticleViewCurrentTest extends PoolWorkArticleViewTest {
|
|||
*/
|
||||
public function testFetchAfterMissWithLock() {
|
||||
$bag = new HashBagOStuff();
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
|
||||
$this->installParserCache( $bag );
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class PoolWorkArticleViewOldTest extends PoolWorkArticleViewTest {
|
|||
$options = null
|
||||
) {
|
||||
if ( !$options ) {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
}
|
||||
|
||||
if ( !$rev ) {
|
||||
|
|
@ -70,7 +70,7 @@ class PoolWorkArticleViewOldTest extends PoolWorkArticleViewTest {
|
|||
}
|
||||
|
||||
public function testUpdateCachedOutput() {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
|
||||
$cache = $this->installRevisionOutputCache();
|
||||
|
|
@ -90,7 +90,7 @@ class PoolWorkArticleViewOldTest extends PoolWorkArticleViewTest {
|
|||
|
||||
$cache = $this->installRevisionOutputCache();
|
||||
|
||||
$parserOptions = ParserOptions::newCanonical( 'canonical' );
|
||||
$parserOptions = ParserOptions::newFromAnon();
|
||||
$parserOptions->setWrapOutputClass( 'wrapwrap' ); // Not safe to cache!
|
||||
|
||||
$work = $this->newPoolWorkArticleView( $page, null, $parserOptions );
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
|
|||
$options = null
|
||||
) {
|
||||
if ( !$options ) {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
}
|
||||
|
||||
if ( !$rev ) {
|
||||
|
|
@ -66,7 +66,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testDoWorkLoadRevision() {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
$rev1 = $this->makeRevision( $page, 'First!' );
|
||||
$rev2 = $this->makeRevision( $page, 'Second!' );
|
||||
|
|
@ -83,7 +83,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testDoWorkParserCache() {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
$rev1 = $this->makeRevision( $page, 'First!' );
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testDoWorkWithFakeRevision() {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
$rev = $this->makeRevision( $page, 'NOPE' );
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
|
|||
public function testMagicWords( $wikitext, $callback ) {
|
||||
static $counter = 1;
|
||||
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getNonexistingTestPage( __METHOD__ . $counter++ );
|
||||
$this->editPage( $page, $wikitext );
|
||||
$rev = $page->getRevisionRecord();
|
||||
|
|
@ -174,7 +174,7 @@ class PoolWorkArticleViewTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testDoWorkDeletedContent() {
|
||||
$options = ParserOptions::newCanonical( 'canonical' );
|
||||
$options = ParserOptions::newFromAnon();
|
||||
$page = $this->getExistingTestPage( __METHOD__ );
|
||||
$rev1 = $page->getRevisionRecord();
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class ContentHandlerFunctionalTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$title = $this->getExistingTestPage()->getTitle();
|
||||
$user = $this->getTestUser()->getUser();
|
||||
$popts = ParserOptions::newCanonical( 'canonical' );
|
||||
$popts = ParserOptions::newFromAnon();
|
||||
$content = $handler->makeEmptyContent();
|
||||
|
||||
$this->assertInstanceOf(
|
||||
|
|
@ -120,7 +120,7 @@ class ContentHandlerFunctionalTest extends MediaWikiIntegrationTestCase {
|
|||
->getContentHandler( $model );
|
||||
|
||||
$title = $this->getExistingTestPage()->getTitle();
|
||||
$popts = ParserOptions::newCanonical( 'canonical' );
|
||||
$popts = ParserOptions::newFromAnon();
|
||||
$content = $handler->makeEmptyContent();
|
||||
|
||||
$this->assertInstanceOf(
|
||||
|
|
|
|||
Loading…
Reference in a new issue