* Clean up tests so that they run together as well as separately
authorMark A. Hershberger <mah@users.mediawiki.org>
Wed, 28 Apr 2010 04:27:30 +0000 (04:27 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Wed, 28 Apr 2010 04:27:30 +0000 (04:27 +0000)
* TODO: Still tracking down a bug with the tests+jobqueue that shows up during UploadFromURLTest.php

maintenance/tests/LanguageConverterTest.php
maintenance/tests/MessageTest.php
maintenance/tests/SearchUpdateTest.php
maintenance/tests/TimeAdjustTest.php
maintenance/tests/bootstrap.php
maintenance/tests/phpunit.xml

index 22b396e..d695a44 100644 (file)
@@ -75,6 +75,7 @@ class LanguageConverterTest extends PHPUnit_Framework_TestCase {
 
                $wgUser = new User;
                $wgUser->setId(1);
+               $wgUser->mDataLoaded = true;
                $wgUser->setOption('variant', 'tg-latn');
 
                $this->assertEquals('tg', $this->lc->getPreferredVariant(false, false));
index f1b9bfc..a0bc966 100644 (file)
@@ -25,7 +25,7 @@ class MessageTest extends PHPUnit_Framework_TestCase {
        }
 
        /**
-        * @expectedException
+        * @expectedException MWException
         */
        function testInLanguageThrows() {
                Message::key( 'foo' )->inLanguage( 123 );
index d21319a..973149e 100644 (file)
@@ -43,6 +43,10 @@ class MockSearch extends SearchEngine {
 }
 
 class SearchUpdateTest extends PHPUnit_Framework_TestCase {
+       static $searchType;
+       static $dbtype;
+       static $factoryconf;
+       static $dbservers;
 
        function update( $text, $title = 'Test', $id = 1 ) {
                $u = new SearchUpdate( $id, $title, $text );
@@ -58,6 +62,12 @@ class SearchUpdateTest extends PHPUnit_Framework_TestCase {
 
        function setUp() {
                global $wgSearchType, $wgDBtype, $wgLBFactoryConf, $wgDBservers;
+
+               self::$searchType  = $wgSearchType;
+               self::$dbtype      = $wgDBtype;
+               self::$factoryconf = $wgLBFactoryConf;
+               self::$dbservers   = $wgDBservers;
+
                $wgSearchType = 'MockSearch';
                $wgDBtype = 'mock';
                $wgLBFactoryConf['class'] = 'LBFactory_Simple';
@@ -66,7 +76,14 @@ class SearchUpdateTest extends PHPUnit_Framework_TestCase {
        }
 
        function tearDown() {
+               global $wgSearchType, $wgDBtype, $wgLBFactoryConf, $wgDBservers;
+
                LBFactory::destroyInstance();
+
+               $wgSearchType = self::$searchType;
+               $wgDBtype = self::$dbtype;
+               $wgLBFactoryConf = self::$factoryconf;
+               $wgDBservers = self::$dbservers;
        }
 
        function testUpdateText() {
index bbd697b..9fbe048 100644 (file)
@@ -1,11 +1,20 @@
 <?php
 
 class TimeAdjustTest extends PHPUnit_Framework_TestCase {
+       static $offset;
 
        public function setUp() {
+               global $wgLocalTZoffset;
+               self::$offset = $wgLocalTZoffset;
+
                $this->iniSet( 'precision', 15 );
        }
 
+       public function tearDown() {
+               global $wgLocalTZoffset;
+               $wgLocalTZoffset = self::$offset;
+       }
+
        # Test offset usage for a given language::userAdjust
        function testUserAdjust() {
                global $wgLocalTZoffset, $wgContLang, $wgUser;
index 928212a..d5232c0 100644 (file)
@@ -12,6 +12,7 @@ $IP = dirname( dirname( dirname( __FILE__ ) ) );
 define( 'MW_PHPUNIT_TEST', true );
 
 require_once( "$IP/maintenance/commandLine.inc" );
+$wgLocaltimezone = 'UTC';
 
 if( !version_compare(PHPUnit_Runner_Version::id(), "3.4.1", ">") ) {
   echo <<<EOF
index 1d04b7f..79be95a 100644 (file)
@@ -8,17 +8,31 @@
          stopOnFailure="false">
   <testsuite name="MediaWiki Test Suite">
     <!-- <directory>.</directory> -->
-    <file>ApiTest.php</file>
+    <!-- <file>ApiTest.php</file> -->
+    <!-- <file>ApiWatchTest.php</file> -->
+    <file>CdbTest.php</file>
+    <file>DatabaseSqliteTest.php</file>
+    <file>DatabaseTest.php</file>
+    <file>GlobalTest.php</file>
     <file>HttpTest.php</file>
+    <file>IPTest.php</file>
+    <file>ImageFunctionsTest.php</file>
     <file>LanguageConverterTest.php</file>
+    <file>LicensesTest.php</file>
     <file>LocalFileTest.php</file>
     <file>MediaWikiParserTest.php</file>
+    <file>MessageTest.php</file>
     <file>RevisionTest.php</file>
+    <file>SanitizerTest.php</file>
     <file>SearchDbTest.php</file>
+    <file>SearchEngineTest.php</file>
+    <file>SearchUpdateTest.php</file>
     <file>SiteConfigurationTest.php</file>
     <file>TimeAdjustTest.php</file>
+    <file>TitlePermissionTest.php</file>
     <file>TitleTest.php</file>
     <file>UploadTest.php</file>
+    <file>UploadFromUrlTest.php</file>
     <file>XmlTest.php</file>
   </testsuite>
   <groups>