tests: always call parent setUp
authorAntoine Musso <hashar@free.fr>
Tue, 23 Oct 2012 17:02:36 +0000 (19:02 +0200)
committerAntoine Musso <hashar@free.fr>
Tue, 23 Oct 2012 17:04:40 +0000 (19:04 +0200)
Some class extending MediaWikiTestCase did not call its setUp method. We
most probably always want to do it since MediaWikiTestCase::setUp() does
garbage collection and might do more in the future.

Change-Id: I68dde370a62c8f4a779836ca0c4ad06844fdc916

22 files changed:
tests/phpunit/includes/ArticleTest.php
tests/phpunit/includes/CdbTest.php
tests/phpunit/includes/FauxResponseTest.php
tests/phpunit/includes/FormOptionsInitializationTest.php
tests/phpunit/includes/FormOptionsTest.php
tests/phpunit/includes/LinksUpdateTest.php
tests/phpunit/includes/PathRouterTest.php
tests/phpunit/includes/RevisionStorageTest.php
tests/phpunit/includes/SiteConfigurationTest.php
tests/phpunit/includes/TextContentTest.php
tests/phpunit/includes/TitleMethodsTest.php
tests/phpunit/includes/WikitextContentHandlerTest.php
tests/phpunit/includes/XmlSelectTest.php
tests/phpunit/includes/ZipDirectoryReaderTest.php
tests/phpunit/includes/db/DatabaseTest.php
tests/phpunit/includes/debug/MWDebugTest.php
tests/phpunit/includes/media/PNGMetadataExtractorTest.php
tests/phpunit/includes/media/SVGMetadataExtractorTest.php
tests/phpunit/includes/media/XMPTest.php
tests/phpunit/includes/parser/ParserPreloadTest.php
tests/phpunit/includes/parser/PreprocessorTest.php
tests/phpunit/includes/specials/SpecialRecentchangesTest.php

index 46aaa4b..20952b1 100644 (file)
@@ -13,16 +13,16 @@ class ArticleTest extends MediaWikiTestCase {
 
        /** creates a title object and its article object */
        protected function setUp() {
+               parent::setUp();
                $this->title = Title::makeTitle( NS_MAIN, 'SomePage' );
                $this->article = new Article( $this->title );
-
        }
 
        /** cleanup title object and its article object */
        protected function tearDown() {
+               parent::tearDown();
                $this->title = null;
                $this->article = null;
-
        }
 
        function testImplementsGetMagic() {
index 97fffda..7db8c8c 100644 (file)
@@ -7,6 +7,7 @@
 class CdbTest extends MediaWikiTestCase {
 
        protected function setUp() {
+               parent::setUp();
                if ( !CdbReader::haveExtension() ) {
                        $this->markTestSkipped( 'Native CDB support is not available' );
                }
index 35c7f8f..56691c9 100644 (file)
@@ -26,6 +26,7 @@ class FauxResponseTest extends MediaWikiTestCase {
        var $response;
 
        protected function setUp() {
+               parent::setUp();
                $this->response = new FauxResponse;
        }
 
index d86c95d..af28f79 100644 (file)
@@ -41,8 +41,8 @@ class FormOptionsInitializationTest extends MediaWikiTestCase {
         * with.
         */
        protected function setUp() {
+               parent::setUp();
                $this->object = new FormOptionsExposed();
-               
        }
 
        public function testAddStringOption() {
index 749343e..d4e3c5e 100644 (file)
@@ -23,12 +23,13 @@ class FormOptionsTest extends MediaWikiTestCase {
        protected $object;
 
        /**
-        * Instanciates a FormOptions object to play with.       
+        * Instanciates a FormOptions object to play with.
         * FormOptions::add() is tested by the class FormOptionsInitializationTest
         * so we assume the function is well tested already an use it to create
         * the fixture.
         */
        protected function setUp() {
+               parent::setUp();
                $this->object = new FormOptions;
                $this->object->add( 'string1', 'string one' );
                $this->object->add( 'string2', 'string two' );
index bc71ab7..7499272 100644 (file)
@@ -26,6 +26,7 @@ class LinksUpdateTest extends MediaWikiTestCase {
        }
 
        protected function setUp() {
+               parent::setUp();
                $dbw = wfGetDB( DB_MASTER );
                $dbw->replace(
                        'interwiki',
index 4487210..910743e 100644 (file)
@@ -6,6 +6,7 @@
 class PathRouterTest extends MediaWikiTestCase {
 
        protected function setUp() {
+               parent::setUp();
                $router = new PathRouter;
                $router->add("/wiki/$1");
                $this->basicRouter = $router;
index 8d2a7bd..fbaa34c 100644 (file)
@@ -41,6 +41,8 @@ class RevisionStorageTest extends MediaWikiTestCase {
        public function setUp() {
                global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
 
+               parent::setUp();
+
                $wgExtraNamespaces[ 12312 ] = 'Dummy';
                $wgExtraNamespaces[ 12313 ] = 'Dummy_talk';
 
@@ -57,6 +59,8 @@ class RevisionStorageTest extends MediaWikiTestCase {
        public function tearDown() {
                global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
 
+               parent::tearDown();
+
                unset( $wgExtraNamespaces[ 12312 ] );
                unset( $wgExtraNamespaces[ 12313 ] );
 
index 4e0d2f4..27c0bb5 100644 (file)
@@ -26,6 +26,8 @@ class SiteConfigurationTest extends MediaWikiTestCase {
        var $mConf;
 
        protected function setUp() {
+               parent::setUp();
+
                $this->mConf = new SiteConfiguration;
 
                $this->mConf->suffixes = array( 'wiki' );
@@ -92,7 +94,6 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                $GLOBALS['global'] = array( 'global' => 'global' );
        }
 
-
        function testSiteFromDb() {
                $this->assertEquals(
                        array( 'wikipedia', 'en' ),
index 10934b4..b80af29 100644 (file)
@@ -11,6 +11,8 @@ class TextContentTest extends MediaWikiTestCase {
        public function setup() {
                global $wgUser;
 
+               parent::setUp();
+
                // anon user
                $wgUser = new User();
                $wgUser->setName( '127.0.0.1' );
index 44fd690..c12fb22 100644 (file)
@@ -12,6 +12,8 @@ class TitleMethodsTest extends MediaWikiTestCase {
        public function setup() {
                global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContLang;
 
+               parent::setUp();
+
                $this->mergeMwGlobalArrayValue(
                        'wgExtraNamespaces',
                        array(
@@ -34,6 +36,8 @@ class TitleMethodsTest extends MediaWikiTestCase {
        public function teardown() {
                global $wgContLang;
 
+               parent::tearDown();
+
                MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache
                $wgContLang->resetNamespaces(); # reset namespace cache
        }
index 8aeb529..8db96d1 100644 (file)
@@ -11,12 +11,10 @@ class WikitextContentHandlerTest extends MediaWikiTestCase {
        var $handler;
 
        public function setup() {
+               parent::setUp();
                $this->handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT );
        }
 
-       public function teardown() {
-       }
-
        public function testSerializeContent( ) {
                $content = new WikitextContent( 'hello world' );
 
index 75bd922..1b48ad2 100644 (file)
@@ -5,9 +5,11 @@ class XmlSelectTest extends MediaWikiTestCase {
        protected $select;
 
        protected function setUp() {
+               parent::setUp();
                $this->select = new XmlSelect();
        }
        protected function tearDown() {
+               parent::tearDown();
                $this->select = null;
        }
 
index 81b32c2..9a03d5c 100644 (file)
@@ -4,6 +4,7 @@ class ZipDirectoryReaderTest extends MediaWikiTestCase {
        var $zipDir, $entries;
 
        protected function setUp() {
+               parent::setUp();
                $this->zipDir = __DIR__ . '/../data/zip';
        }
 
index a8a6b48..cbbdc1f 100644 (file)
@@ -8,10 +8,12 @@ class DatabaseTest extends MediaWikiTestCase {
        var $db, $functionTest = false;
 
        protected function setUp() {
+               parent::setUp();
                $this->db = wfGetDB( DB_MASTER );
        }
 
        protected function tearDown() {
+               parent::tearDown();
                if ( $this->functionTest ) {
                        $this->dropFunctions();
                        $this->functionTest = false;
index 4f338d3..bd2c388 100644 (file)
@@ -4,6 +4,7 @@ class MWDebugTest extends MediaWikiTestCase {
 
 
        protected function setUp() {
+               parent::setUp();
                // Make sure MWDebug class is enabled
                static $MWDebugEnabled = false;
                if( !$MWDebugEnabled ) {
@@ -17,6 +18,7 @@ class MWDebugTest extends MediaWikiTestCase {
 
        protected function tearDown() {
                wfRestoreWarnings();
+               parent::tearDown();
        }
 
        function testAddLog() {
index ee1c6f8..e027668 100644 (file)
@@ -2,6 +2,7 @@
 class PNGMetadataExtractorTest extends MediaWikiTestCase {
 
        protected function setUp() {
+               parent::setUp();
                $this->filePath = __DIR__ . '/../../data/media/';
        }
        /**
index 007ce46..d9a59ca 100644 (file)
@@ -3,6 +3,7 @@
 class SVGMetadataExtractorTest extends MediaWikiTestCase {
 
        protected function setUp() {
+               parent::setUp();
                AutoLoader::loadClass( 'SVGMetadataExtractorTest' );
        }
 
index be02dd7..452016f 100644 (file)
@@ -2,6 +2,7 @@
 class XMPTest extends MediaWikiTestCase {
 
        protected function setUp() {
+               parent::setUp();
                if ( !wfDl( 'xml' ) ) {
                        $this->markTestSkipped( 'Requires libxml to do XMP parsing' );
                }
index d537b6e..cb5588b 100644 (file)
@@ -9,6 +9,8 @@ class ParserPreloadTest extends MediaWikiTestCase {
        private $title;
 
        protected function setUp() {
+               parent::setUp();
+
                $this->testParserOptions = new ParserOptions();
 
                $this->testParser = new Parser();
@@ -19,6 +21,8 @@ class ParserPreloadTest extends MediaWikiTestCase {
        }
 
        protected function tearDown() {
+               parent::tearDown();
+
                unset( $this->testParser );
                unset( $this->title );
        }
index d82fc6c..0e2bbab 100644 (file)
@@ -7,6 +7,7 @@ class PreprocessorTest extends MediaWikiTestCase {
 
        protected function setUp() {
                global $wgParserConf;
+               parent::setUp();
                $this->mOptions = new ParserOptions();
                $name = isset( $wgParserConf['preprocessorClass'] ) ? $wgParserConf['preprocessorClass'] : 'Preprocessor_DOM';
 
index f102309..82426bd 100644 (file)
@@ -14,9 +14,6 @@ class SpecialRecentchangesTest extends MediaWikiTestCase {
         */
        protected $rc;
 
-       protected function setUp() {
-       }
-
        /** helper to test SpecialRecentchanges::buildMainQueryConds() */
        private function assertConditions( $expected, $requestOptions = null, $message = '' ) {
                $context = new RequestContext;