diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
commit | 222b01f5169f1c7e69762e0e8904c24f78f71882 (patch) | |
tree | 8e932e12546bb991357ec48eb1638d1770be7a35 /maintenance/tests/MediaWiki_Setup.php | |
parent | 00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff) |
update to MediaWiki 1.16.0
Diffstat (limited to 'maintenance/tests/MediaWiki_Setup.php')
-rw-r--r-- | maintenance/tests/MediaWiki_Setup.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/maintenance/tests/MediaWiki_Setup.php b/maintenance/tests/MediaWiki_Setup.php new file mode 100644 index 00000000..e7acc338 --- /dev/null +++ b/maintenance/tests/MediaWiki_Setup.php @@ -0,0 +1,28 @@ +<?php + +abstract class MediaWiki_Setup extends PHPUnit_Framework_TestCase { + + protected function buildTestDatabase( $tables ) { + global $wgDBprefix; + + $db = wfGetDB( DB_MASTER ); + $oldTableNames = array(); + foreach( $tables as $table ) + $oldTableNames[$table] = $db->tableName( $table ); + $db->tablePrefix( 'parsertest_' ); + + if( $db->isOpen() ) { + foreach ( $tables as $tbl ) { + $newTableName = $db->tableName( $tbl ); + $tableName = $oldTableNames[$tbl]; + $db->query( "DROP TABLE IF EXISTS $newTableName", __METHOD__ ); + $db->duplicateTableStructure( $tableName, $newTableName, __METHOD__ ); + } + return $db; + } else { + // Something amiss + return null; + } + } +} + |