wiki.techinc.nl/tests/phpunit/includes/ArticleTablesTest.php
Paul Copperman f7e6dfb4a3 Various fixes for PHPUnit tests:
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename	to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php: 
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.
2011-04-07 14:54:38 +00:00

51 lines
1.4 KiB
PHP

<?php
/**
* @group Database
* @group Destructive
*/
class ArticleTablesTest extends MediaWikiTestCase {
function setUp() {
global $wgLanguageCode;
$this->languageCode = $wgLanguageCode;
}
function tearDown() {
global $wgLanguageCode, $wgContLang, $wgLang;
$wgLanguageCode = $this->languageCode;
$wgContLang = new StubContLang;
$wgLang = new StubUserLang;
}
/**
* @group Broken
*/
function testbug14404() {
global $wgUser, $wgContLang, $wgLanguageCode, $wgLang;
$title = Title::newFromText("Bug 14404");
$article = new Article( $title );
$wgUser = new User();
$wgUser->mRights = array( 'createpage', 'edit', 'purge' );
$wgLanguageCode = 'es';
$wgContLang = Language::factory( 'es' );
$wgLang = Language::factory( 'fr' );
$status = $article->doEdit( '{{:{{int:history}}}}', 'Test code for bug 14404', 0 );
$templates1 = $article->getUsedTemplates();
$wgLang = Language::factory( 'de' );
$article->mParserOptions = null; // Let it pick the new user language
$article->mPreparedEdit = false; // In order to force the rerendering of the same wikitext
// We need an edit, a purge is not enough to regenerate the tables
$status = $article->doEdit( '{{:{{int:history}}}}', 'Test code for bug 14404', EDIT_UPDATE );
$templates2 = $article->getUsedTemplates();
$this->assertEquals( $templates1, $templates2 );
$this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
}
}