From: Antoine Musso Date: Tue, 23 Oct 2012 17:02:36 +0000 (+0200) Subject: tests: always call parent setUp X-Git-Tag: 1.31.0-rc.0~21900^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=c6ea55bf542176117699bb81299aad67ca9c5781;p=lhc%2Fweb%2Fwiklou.git tests: always call parent setUp 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 --- diff --git a/tests/phpunit/includes/ArticleTest.php b/tests/phpunit/includes/ArticleTest.php index 46aaa4b04c..20952b1ec4 100644 --- a/tests/phpunit/includes/ArticleTest.php +++ b/tests/phpunit/includes/ArticleTest.php @@ -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() { diff --git a/tests/phpunit/includes/CdbTest.php b/tests/phpunit/includes/CdbTest.php index 97fffda03e..7db8c8c8b3 100644 --- a/tests/phpunit/includes/CdbTest.php +++ b/tests/phpunit/includes/CdbTest.php @@ -7,6 +7,7 @@ class CdbTest extends MediaWikiTestCase { protected function setUp() { + parent::setUp(); if ( !CdbReader::haveExtension() ) { $this->markTestSkipped( 'Native CDB support is not available' ); } diff --git a/tests/phpunit/includes/FauxResponseTest.php b/tests/phpunit/includes/FauxResponseTest.php index 35c7f8f42b..56691c9e01 100644 --- a/tests/phpunit/includes/FauxResponseTest.php +++ b/tests/phpunit/includes/FauxResponseTest.php @@ -26,6 +26,7 @@ class FauxResponseTest extends MediaWikiTestCase { var $response; protected function setUp() { + parent::setUp(); $this->response = new FauxResponse; } diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/includes/FormOptionsInitializationTest.php index d86c95d7c8..af28f79642 100644 --- a/tests/phpunit/includes/FormOptionsInitializationTest.php +++ b/tests/phpunit/includes/FormOptionsInitializationTest.php @@ -41,8 +41,8 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { * with. */ protected function setUp() { + parent::setUp(); $this->object = new FormOptionsExposed(); - } public function testAddStringOption() { diff --git a/tests/phpunit/includes/FormOptionsTest.php b/tests/phpunit/includes/FormOptionsTest.php index 749343eccc..d4e3c5ef68 100644 --- a/tests/phpunit/includes/FormOptionsTest.php +++ b/tests/phpunit/includes/FormOptionsTest.php @@ -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' ); diff --git a/tests/phpunit/includes/LinksUpdateTest.php b/tests/phpunit/includes/LinksUpdateTest.php index bc71ab7f3e..74992723d0 100644 --- a/tests/phpunit/includes/LinksUpdateTest.php +++ b/tests/phpunit/includes/LinksUpdateTest.php @@ -26,6 +26,7 @@ class LinksUpdateTest extends MediaWikiTestCase { } protected function setUp() { + parent::setUp(); $dbw = wfGetDB( DB_MASTER ); $dbw->replace( 'interwiki', diff --git a/tests/phpunit/includes/PathRouterTest.php b/tests/phpunit/includes/PathRouterTest.php index 4487210a50..910743e047 100644 --- a/tests/phpunit/includes/PathRouterTest.php +++ b/tests/phpunit/includes/PathRouterTest.php @@ -6,6 +6,7 @@ class PathRouterTest extends MediaWikiTestCase { protected function setUp() { + parent::setUp(); $router = new PathRouter; $router->add("/wiki/$1"); $this->basicRouter = $router; diff --git a/tests/phpunit/includes/RevisionStorageTest.php b/tests/phpunit/includes/RevisionStorageTest.php index 8d2a7bde44..fbaa34cee2 100644 --- a/tests/phpunit/includes/RevisionStorageTest.php +++ b/tests/phpunit/includes/RevisionStorageTest.php @@ -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 ] ); diff --git a/tests/phpunit/includes/SiteConfigurationTest.php b/tests/phpunit/includes/SiteConfigurationTest.php index 4e0d2f42a7..27c0bb5114 100644 --- a/tests/phpunit/includes/SiteConfigurationTest.php +++ b/tests/phpunit/includes/SiteConfigurationTest.php @@ -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' ), diff --git a/tests/phpunit/includes/TextContentTest.php b/tests/phpunit/includes/TextContentTest.php index 10934b4ec8..b80af298d6 100644 --- a/tests/phpunit/includes/TextContentTest.php +++ b/tests/phpunit/includes/TextContentTest.php @@ -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' ); diff --git a/tests/phpunit/includes/TitleMethodsTest.php b/tests/phpunit/includes/TitleMethodsTest.php index 44fd69008d..c12fb22897 100644 --- a/tests/phpunit/includes/TitleMethodsTest.php +++ b/tests/phpunit/includes/TitleMethodsTest.php @@ -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 } diff --git a/tests/phpunit/includes/WikitextContentHandlerTest.php b/tests/phpunit/includes/WikitextContentHandlerTest.php index 8aeb529e8e..8db96d1b56 100644 --- a/tests/phpunit/includes/WikitextContentHandlerTest.php +++ b/tests/phpunit/includes/WikitextContentHandlerTest.php @@ -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' ); diff --git a/tests/phpunit/includes/XmlSelectTest.php b/tests/phpunit/includes/XmlSelectTest.php index 75bd9222c1..1b48ad273a 100644 --- a/tests/phpunit/includes/XmlSelectTest.php +++ b/tests/phpunit/includes/XmlSelectTest.php @@ -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; } diff --git a/tests/phpunit/includes/ZipDirectoryReaderTest.php b/tests/phpunit/includes/ZipDirectoryReaderTest.php index 81b32c2b99..9a03d5c18b 100644 --- a/tests/phpunit/includes/ZipDirectoryReaderTest.php +++ b/tests/phpunit/includes/ZipDirectoryReaderTest.php @@ -4,6 +4,7 @@ class ZipDirectoryReaderTest extends MediaWikiTestCase { var $zipDir, $entries; protected function setUp() { + parent::setUp(); $this->zipDir = __DIR__ . '/../data/zip'; } diff --git a/tests/phpunit/includes/db/DatabaseTest.php b/tests/phpunit/includes/db/DatabaseTest.php index a8a6b48a89..cbbdc1f4b8 100644 --- a/tests/phpunit/includes/db/DatabaseTest.php +++ b/tests/phpunit/includes/db/DatabaseTest.php @@ -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; diff --git a/tests/phpunit/includes/debug/MWDebugTest.php b/tests/phpunit/includes/debug/MWDebugTest.php index 4f338d31bf..bd2c38813a 100644 --- a/tests/phpunit/includes/debug/MWDebugTest.php +++ b/tests/phpunit/includes/debug/MWDebugTest.php @@ -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() { diff --git a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php index ee1c6f8216..e027668f59 100644 --- a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php @@ -2,6 +2,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { protected function setUp() { + parent::setUp(); $this->filePath = __DIR__ . '/../../data/media/'; } /** diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php index 007ce46c2c..d9a59ca6c3 100644 --- a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -3,6 +3,7 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { protected function setUp() { + parent::setUp(); AutoLoader::loadClass( 'SVGMetadataExtractorTest' ); } diff --git a/tests/phpunit/includes/media/XMPTest.php b/tests/phpunit/includes/media/XMPTest.php index be02dd71ef..452016fc10 100644 --- a/tests/phpunit/includes/media/XMPTest.php +++ b/tests/phpunit/includes/media/XMPTest.php @@ -2,6 +2,7 @@ class XMPTest extends MediaWikiTestCase { protected function setUp() { + parent::setUp(); if ( !wfDl( 'xml' ) ) { $this->markTestSkipped( 'Requires libxml to do XMP parsing' ); } diff --git a/tests/phpunit/includes/parser/ParserPreloadTest.php b/tests/phpunit/includes/parser/ParserPreloadTest.php index d537b6e116..cb5588b11f 100644 --- a/tests/phpunit/includes/parser/ParserPreloadTest.php +++ b/tests/phpunit/includes/parser/ParserPreloadTest.php @@ -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 ); } diff --git a/tests/phpunit/includes/parser/PreprocessorTest.php b/tests/phpunit/includes/parser/PreprocessorTest.php index d82fc6c09d..0e2bbabf3e 100644 --- a/tests/phpunit/includes/parser/PreprocessorTest.php +++ b/tests/phpunit/includes/parser/PreprocessorTest.php @@ -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'; diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php index f1023093d2..82426bdaa2 100644 --- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php +++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php @@ -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;