Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92270
Change subject: Unbreak some unit tests
......................................................................
Unbreak some unit tests
Not all installations will have a user with the id of 2,
like jenkins. At some point User::getOption is called, which
requires loading the user from the database, except it
doesn't exist. At which point the user id is reset to 0,
so it becomes an anonymous user, breaking the test.
Since the MediaWiki test runner automatically
creates a test user, we can safely assume that there is
a user with the id 1.
Change-Id: Iacf904d04f1ff5aaf584cb98c3083ef6d7d89cea
---
M tests/EmailFormatterTest.php
M tests/NotificationFormatterTest.php
2 files changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/70/92270/1
diff --git a/tests/EmailFormatterTest.php b/tests/EmailFormatterTest.php
index a8609d5..ef69e5b 100644
--- a/tests/EmailFormatterTest.php
+++ b/tests/EmailFormatterTest.php
@@ -19,10 +19,10 @@
$formatter = EchoNotificationFormatter::factory(
$wgEchoNotifications[$event->getType()] );
$formatter->setOutputFormat( 'email' );
- $user = User::newFromId( 2 );
+ $user = User::newFromId( 1 );
$user->setName( 'Test' );
$user->setOption( 'echo-email-format',
EchoHooks::EMAIL_FORMAT_HTML );
-
+
$this->emailSingle = new EchoEmailSingle( $formatter, $event,
$user );
$content[$event->getCategory()][] =
EchoNotificationController::formatNotification( $event, $user, 'email',
'emaildigest' );
diff --git a/tests/NotificationFormatterTest.php
b/tests/NotificationFormatterTest.php
index 43eb84b..c2d63de 100644
--- a/tests/NotificationFormatterTest.php
+++ b/tests/NotificationFormatterTest.php
@@ -206,7 +206,7 @@
$formatter->setOutputFormat( $format );
// Notification users can not be anonymous, use a fake user id
- return $formatter->format( $event, User::newFromId( 2 ), $type
);
+ return $formatter->format( $event, User::newFromId( 1 ), $type
);
}
protected function mockEvent( $type, array $extra = array(), Revision
$rev = null ) {
--
To view, visit https://gerrit.wikimedia.org/r/92270
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iacf904d04f1ff5aaf584cb98c3083ef6d7d89cea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits