Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / page / ArticleTablesTest.php
blob6c2636461963de40042066d9ac19747781d93b05
1 <?php
3 use MediaWiki\Content\WikitextContent;
4 use MediaWiki\Title\Title;
6 /**
7 * @group Database
8 */
9 class ArticleTablesTest extends MediaWikiLangTestCase {
11 /**
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
14 * content language.
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}}}}' ),
30 $user,
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}}}}' ),
41 $user,
42 'Test code for T16404',
43 EDIT_UPDATE
45 $templates2 = $title->getTemplateLinksFrom();
47 /**
48 * @var Title[] $templates1
49 * @var Title[] $templates2
51 $this->assertEquals( $templates1, $templates2 );
52 $this->assertSame( 'Historial', $templates1[0]->getFullText() );