mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-12 07:05:09 +00:00
411ee7efad
Changes to the use statements done automatically via script Change-Id: I0768f296b528c81edd6bd9ac7d76515b15f3da6f
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Cite\Tests;
|
|
|
|
use MediaWiki\Parser\ParserOptions;
|
|
use MediaWiki\Title\Title;
|
|
|
|
/**
|
|
* @group Database
|
|
* @covers \Cite\ReferenceStack
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
class CiteDbTest extends \MediaWikiIntegrationTestCase {
|
|
/**
|
|
* Parser call within `<ref>` parse clears the original parser state.
|
|
* @see https://phabricator.wikimedia.org/T240248
|
|
*/
|
|
public function testReferenceStackError() {
|
|
$this->insertPage( 'Cite-tracking-category-cite-error', '{{PAGENAME}}', NS_MEDIAWIKI );
|
|
|
|
$services = $this->getServiceContainer();
|
|
// Reset the MessageCache in order to force it to clone a new parser.
|
|
$services->resetServiceForTesting( 'MessageCache' );
|
|
$services->getMessageCache()->enable();
|
|
|
|
$parserOutput = $services->getParser()->parse(
|
|
'
|
|
<ref name="a">text #1</ref>
|
|
<ref name="a">text #2</ref>
|
|
<ref>text #3</ref>
|
|
',
|
|
Title::makeTitle( NS_MAIN, mt_rand() ),
|
|
ParserOptions::newFromAnon()
|
|
);
|
|
|
|
$this->assertStringContainsString(
|
|
'cite_ref-2',
|
|
$parserOutput->getText(),
|
|
'Internal counter should not reset to 1 for text #3'
|
|
);
|
|
}
|
|
|
|
}
|