Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/66978
Change subject: Ignore hooks in User for unittests (it breaks
tests/phpunit/phpunit.php)
......................................................................
Ignore hooks in User for unittests (it breaks tests/phpunit/phpunit.php)
MediaWikiTestCase::addCoreDBData will create a stub user.
This would result in Echo attempting to insert data in the non-existing
(unittest-prefixed) table unittest_echo_notification
$context->getTitle() also returned null, rather than a Title object
Change-Id: Id01b1dc91abaa5e88d1f15f3346f0f4a0aacac36
---
M Hooks.php
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/78/66978/1
diff --git a/Hooks.php b/Hooks.php
index 2c3b76d..8a8a466 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -766,6 +766,11 @@
* @return bool true in all cases
*/
static function onUserSaveSettings( $user ) {
+ // when running unittests, ignore this
+ if ( defined( 'MW_PHPUNIT_TEST' ) && MW_PHPUNIT_TEST ) {
+ return true;
+ }
+
// Reset the notification count since it may have changed due
to user
// option changes. This covers both explicit changes in the
preferences
// and changes made through the options API (since both call
this hook).
@@ -796,6 +801,11 @@
* @return bool true in all cases
*/
public static function onUserSaveOptions( $user, &$options ) {
+ // when running unittests, ignore this
+ if ( defined( 'MW_PHPUNIT_TEST' ) && MW_PHPUNIT_TEST ) {
+ return true;
+ }
+
global $wgOut;
$context = $wgOut->getContext();
--
To view, visit https://gerrit.wikimedia.org/r/66978
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id01b1dc91abaa5e88d1f15f3346f0f4a0aacac36
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits