2010-12-28 18:43:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group Database
|
|
|
|
|
*/
|
2011-05-01 23:02:27 +00:00
|
|
|
class ArticleTablesTest extends MediaWikiLangTestCase {
|
2013-10-24 10:54:02 +00:00
|
|
|
/**
|
2017-02-20 23:45:58 +00:00
|
|
|
* Make sure that T16404 doesn't strike again. We don't want
|
2014-09-04 01:58:33 +00:00
|
|
|
* templatelinks based on the user language when {{int:}} is used, only the
|
|
|
|
|
* content language.
|
|
|
|
|
*
|
2013-10-24 10:54:02 +00:00
|
|
|
* @covers Title::getTemplateLinksFrom
|
|
|
|
|
* @covers Title::getLinksFrom
|
|
|
|
|
*/
|
2014-09-04 01:58:33 +00:00
|
|
|
public function testTemplatelinksUsesContentLanguage() {
|
2017-02-20 23:45:58 +00:00
|
|
|
$title = Title::newFromText( 'T16404' );
|
2012-02-01 15:53:57 +00:00
|
|
|
$page = WikiPage::factory( $title );
|
|
|
|
|
$user = new User();
|
2016-02-17 09:09:32 +00:00
|
|
|
$user->mRights = [ 'createpage', 'edit', 'purge' ];
|
2016-03-09 16:47:58 +00:00
|
|
|
$this->setContentLang( 'es' );
|
|
|
|
|
$this->setUserLang( 'fr' );
|
2011-08-01 16:01:13 +00:00
|
|
|
|
2014-03-07 20:22:13 +00:00
|
|
|
$page->doEditContent(
|
|
|
|
|
new WikitextContent( '{{:{{int:history}}}}' ),
|
2017-02-20 23:45:58 +00:00
|
|
|
'Test code for T16404',
|
2014-03-07 20:22:13 +00:00
|
|
|
0,
|
|
|
|
|
false,
|
|
|
|
|
$user
|
|
|
|
|
);
|
2012-08-20 14:55:28 +00:00
|
|
|
$templates1 = $title->getTemplateLinksFrom();
|
2010-12-28 18:43:49 +00:00
|
|
|
|
2016-03-09 16:47:58 +00:00
|
|
|
$this->setUserLang( 'de' );
|
2014-03-07 20:22:13 +00:00
|
|
|
$page = WikiPage::factory( $title ); // In order to force the re-rendering of the same wikitext
|
2011-08-01 16:01:13 +00:00
|
|
|
|
2010-12-28 18:43:49 +00:00
|
|
|
// We need an edit, a purge is not enough to regenerate the tables
|
2014-03-07 20:22:13 +00:00
|
|
|
$page->doEditContent(
|
|
|
|
|
new WikitextContent( '{{:{{int:history}}}}' ),
|
2017-02-20 23:45:58 +00:00
|
|
|
'Test code for T16404',
|
2014-03-07 20:22:13 +00:00
|
|
|
EDIT_UPDATE,
|
|
|
|
|
false,
|
|
|
|
|
$user
|
|
|
|
|
);
|
2012-08-20 14:55:28 +00:00
|
|
|
$templates2 = $title->getTemplateLinksFrom();
|
2011-08-01 16:01:13 +00:00
|
|
|
|
2014-03-07 20:22:13 +00:00
|
|
|
/**
|
|
|
|
|
* @var Title[] $templates1
|
|
|
|
|
* @var Title[] $templates2
|
|
|
|
|
*/
|
2010-12-28 18:43:49 +00:00
|
|
|
$this->assertEquals( $templates1, $templates2 );
|
|
|
|
|
$this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
|
|
|
|
|
}
|
|
|
|
|
}
|