jenkins-bot has submitted this change and it was merged.
Change subject: Fix global objects and singletons in NewParserTest
......................................................................
Fix global objects and singletons in NewParserTest
- Don't set $wgMemc, $parserMemc and $messageMemc on each test,
the correct values for $wgMainCacheType and such are already set
in phpunit.php, so those objects are already the good ones
- Only destroy RepoGroup and FileBackendGroup once before starting
the tests instead of two
- No need to clear the MessageCache in addDBData(), it is already
destroyed in setupGlobals() (also avoids creating an object on
some tests to only call clear() on it)
- Group singleton cleanup after the test in tearDown()
Change-Id: Ib2d6522019160f63f3f968e69940413a1def2f8b
---
M tests/phpunit/includes/parser/NewParserTest.php
1 file changed, 8 insertions(+), 12 deletions(-)
Approvals:
Hashar: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/includes/parser/NewParserTest.php
b/tests/phpunit/includes/parser/NewParserTest.php
index f41c71c..7ec364d 100644
--- a/tests/phpunit/includes/parser/NewParserTest.php
+++ b/tests/phpunit/includes/parser/NewParserTest.php
@@ -100,9 +100,6 @@
'createtalk' => true,
) );
$tmpGlobals['wgNamespaceProtection'] = array( NS_MEDIAWIKI =>
'editinterface' );
- $tmpGlobals['wgMemc'] = new EmptyBagOStuff;
- $tmpGlobals['messageMemc'] = wfGetMessageCacheStorage();
- $tmpGlobals['parserMemc'] = wfGetParserCacheStorage();
$tmpGlobals['wgParser'] = new StubObject( 'wgParser',
$GLOBALS['wgParserConf']['class'], array( $GLOBALS['wgParserConf'] ) );
@@ -141,6 +138,12 @@
// Restore backends
RepoGroup::destroySingleton();
FileBackendGroup::destroySingleton();
+
+ // Remove temporary pages from the link cache
+ LinkCache::singleton()->clear();
+
+ // Restore message cache (temporary pages and
$wgUseDatabaseMessages)
+ MessageCache::destroyInstance();
parent::tearDown();
}
@@ -196,9 +199,6 @@
array( 'ss_row_id' => 1, 'ss_images' => 2,
'ss_good_articles' => 1 ),
__METHOD__
);
-
- # Clear the message cache
- MessageCache::singleton()->clear();
$user = User::newFromId( 0 );
LinkCache::singleton()->clear(); # Avoids the odd failure at
creating the nullRevision
@@ -376,6 +376,8 @@
}
MagicWord::clearCache();
+
+ # The entries saved into RepoGroup cache with previous globals
will be wrong.
RepoGroup::destroySingleton();
FileBackendGroup::destroySingleton();
@@ -385,9 +387,6 @@
# Publish the articles after we have the final language set
$this->publishTestArticles();
- # The entries saved into RepoGroup cache with previous globals
will be wrong.
- RepoGroup::destroySingleton();
- FileBackendGroup::destroySingleton();
MessageCache::destroyInstance();
return $context;
@@ -454,9 +453,6 @@
foreach ( $this->savedGlobals as $var => $val ) {
$GLOBALS[$var] = $val;
}
-
- RepoGroup::destroySingleton();
- LinkCache::singleton()->clear();
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/62228
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib2d6522019160f63f3f968e69940413a1def2f8b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits