3 use MediaWiki\Content\WikitextContent
;
4 use MediaWiki\Title\Title
;
9 class ArticleTablesTest
extends MediaWikiLangTestCase
{
12 * Make sure that T16404 doesn't strike again. We don't want
13 * templatelinks based on the user language when {{int:}} is used, only the
16 * @covers \MediaWiki\Title\Title::getTemplateLinksFrom
17 * @covers \MediaWiki\Title\Title::getLinksFrom
19 public function testTemplatelinksUsesContentLanguage() {
20 $title = Title
::makeTitle( NS_MAIN
, 'T16404' );
21 $wikiPageFactory = $this->getServiceContainer()->getWikiPageFactory();
22 $page = $wikiPageFactory->newFromTitle( $title );
23 $user = $this->getTestUser()->getUser();
24 $this->overrideUserPermissions( $user, [ 'createpage', 'edit', 'purge' ] );
25 $this->setContentLang( 'es' );
26 $this->setUserLang( 'fr' );
28 $page->doUserEditContent(
29 new WikitextContent( '{{:{{int:history}}}}' ),
31 'Test code for T16404'
33 $templates1 = $title->getTemplateLinksFrom();
35 $this->setUserLang( 'de' );
36 $page = $wikiPageFactory->newFromTitle( $title ); // In order to force the re-rendering of the same wikitext
38 // We need an edit, a purge is not enough to regenerate the tables
39 $page->doUserEditContent(
40 new WikitextContent( '{{:{{int:history}}}}' ),
42 'Test code for T16404',
45 $templates2 = $title->getTemplateLinksFrom();
48 * @var Title[] $templates1
49 * @var Title[] $templates2
51 $this->assertEquals( $templates1, $templates2 );
52 $this->assertSame( 'Historial', $templates1[0]->getFullText() );