mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 18:30:06 +00:00
phpcs: Break long lines
Use the codesniffer default of length = 120 Change-Id: Ifbfd56b20432e54805d3a9bce22cda888c1fc74d
This commit is contained in:
parent
5c88677659
commit
3c53d6acb9
|
@ -2,7 +2,6 @@
|
|||
<ruleset name="MediaWiki">
|
||||
<file>.</file>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
|
@ -11,13 +10,7 @@
|
|||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||
<exclude name="PSR12.Properties.ConstantVisibility.NotFound" />
|
||||
</rule>
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<properties>
|
||||
<property name="lineLimit" value="140" />
|
||||
</properties>
|
||||
</rule>
|
||||
<arg name="encoding" value="UTF-8" />
|
||||
<arg name="extensions" value="php,php5,inc" />
|
||||
<arg name="colors" />
|
||||
<exclude-pattern>vendor</exclude-pattern>
|
||||
</ruleset>
|
||||
|
|
|
@ -40,7 +40,8 @@ class EchoDeferredMarkAsDeletedUpdate implements DeferrableUpdate {
|
|||
// unreaderable because of replica lag.
|
||||
// Do not moderate it at this time.
|
||||
LoggerFactory::getInstance( 'Echo' )->debug(
|
||||
'EchoDeferredMarkAsDeletedUpdate: Event {eventId} was found unrenderable but its associated title exists on Master. Skipping.',
|
||||
'EchoDeferredMarkAsDeletedUpdate: Event {eventId} was found unrenderable ' .
|
||||
' but its associated title exists on Master. Skipping.',
|
||||
[
|
||||
'eventId' => $event->getId(),
|
||||
'title' => $event->getTitle()->getPrefixedText(),
|
||||
|
|
|
@ -570,7 +570,10 @@ abstract class EchoDiscussionParser {
|
|||
if ( !empty( $sectionSignedUsers ) ) {
|
||||
$signedSections[] = $sectionSpan;
|
||||
if ( !$section['header'] ) {
|
||||
$fullSection = self::getFullSection( $changes['_info']['rhs'], $change['right-pos'] );
|
||||
$fullSection = self::getFullSection(
|
||||
$changes['_info']['rhs'],
|
||||
$change['right-pos']
|
||||
);
|
||||
$section['header'] = self::extractHeader( $fullSection );
|
||||
}
|
||||
$actions[] = [
|
||||
|
|
|
@ -245,7 +245,8 @@ class MWEchoEmailBatch {
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear "processed" events in the queue, processed could be: email sent, invalid, users do not want to receive emails
|
||||
* Clear "processed" events in the queue,
|
||||
* processed could be: email sent, invalid, users do not want to receive emails
|
||||
*/
|
||||
public function clearProcessedEvent() {
|
||||
global $wgUpdateRowsPerQuery;
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
/**
|
||||
* Caches the result of EchoUnreadWikis::getUnreadCounts() and interprets the results in various useful ways.
|
||||
*
|
||||
* If the user has disabled cross-wiki notifications in their preferences (see {@see EchoForeignNotifications::isEnabledByUser}), this class
|
||||
* If the user has disabled cross-wiki notifications in their preferences
|
||||
* (see {@see EchoForeignNotifications::isEnabledByUser}), this class
|
||||
* won't do anything and will behave as if the user has no foreign notifications. For example, getCount() will
|
||||
* return 0. If you need to get foreign notification information for a user even though they may not have
|
||||
* enabled the preference, set $forceEnable=true in the constructor.
|
||||
|
|
|
@ -165,7 +165,8 @@ class MWEchoNotifUser {
|
|||
* If $wgEchoCrossWikiNotifications is disabled, the $global parameter is ignored.
|
||||
*
|
||||
* @param string $section Notification section
|
||||
* @param bool|string $global Whether to include foreign notifications. If set to 'preference', uses the user's preference.
|
||||
* @param bool|string $global Whether to include foreign notifications.
|
||||
* If set to 'preference', uses the user's preference.
|
||||
* @return int
|
||||
*/
|
||||
public function getNotificationCount( $section = EchoAttributeManager::ALL, $global = 'preference' ) {
|
||||
|
@ -212,7 +213,8 @@ class MWEchoNotifUser {
|
|||
* If $wgEchoCrossWikiNotifications is disabled, the $global parameter is ignored.
|
||||
*
|
||||
* @param string $section Notification section
|
||||
* @param bool|string $global Whether to include foreign notifications. If set to 'preference', uses the user's preference.
|
||||
* @param bool|string $global Whether to include foreign notifications.
|
||||
* If set to 'preference', uses the user's preference.
|
||||
* @return bool|MWTimestamp Timestamp of latest unread message, or false if there are no unread messages.
|
||||
*/
|
||||
public function getLastUnreadNotificationTime( $section = EchoAttributeManager::ALL, $global = 'preference' ) {
|
||||
|
@ -260,7 +262,14 @@ class MWEchoNotifUser {
|
|||
$attributeManager = EchoAttributeManager::newFromGlobalVars();
|
||||
$categoryMap = $attributeManager->getEventsByCategory();
|
||||
$usertalkTypes = $categoryMap['edit-user-talk'];
|
||||
$unreadEditUserTalk = $this->notifMapper->fetchUnreadByUser( $this->mUser, 1, null, $usertalkTypes, null, DB_MASTER );
|
||||
$unreadEditUserTalk = $this->notifMapper->fetchUnreadByUser(
|
||||
$this->mUser,
|
||||
1,
|
||||
null,
|
||||
$usertalkTypes,
|
||||
null,
|
||||
DB_MASTER
|
||||
);
|
||||
if ( $unreadEditUserTalk === [] ) {
|
||||
$talkPageNotificationManager->removeUserHasNewMessages( $this->mUser );
|
||||
}
|
||||
|
@ -295,7 +304,14 @@ class MWEchoNotifUser {
|
|||
$attributeManager = EchoAttributeManager::newFromGlobalVars();
|
||||
$categoryMap = $attributeManager->getEventsByCategory();
|
||||
$usertalkTypes = $categoryMap['edit-user-talk'];
|
||||
$unreadEditUserTalk = $this->notifMapper->fetchUnreadByUser( $this->mUser, 1, null, $usertalkTypes, null, DB_MASTER );
|
||||
$unreadEditUserTalk = $this->notifMapper->fetchUnreadByUser(
|
||||
$this->mUser,
|
||||
1,
|
||||
null,
|
||||
$usertalkTypes,
|
||||
null,
|
||||
DB_MASTER
|
||||
);
|
||||
if ( $unreadEditUserTalk !== [] ) {
|
||||
$talkPageNotificationManager->setUserHasNewMessages( $this->mUser );
|
||||
}
|
||||
|
@ -546,13 +562,28 @@ class MWEchoNotifUser {
|
|||
$totals = [ 'count' => 0, 'timestamp' => -1 ];
|
||||
|
||||
foreach ( EchoAttributeManager::$sections as $section ) {
|
||||
$eventTypesToLoad = $attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', [ $section ] );
|
||||
$eventTypesToLoad = $attributeManager->getUserEnabledEventsbySections(
|
||||
$this->mUser,
|
||||
'web',
|
||||
[ $section ]
|
||||
);
|
||||
|
||||
$count = (int)$this->userNotifGateway->getCappedNotificationCount( $dbSource, $eventTypesToLoad, self::MAX_BADGE_COUNT + 1 );
|
||||
$count = (int)$this->userNotifGateway->getCappedNotificationCount(
|
||||
$dbSource,
|
||||
$eventTypesToLoad,
|
||||
self::MAX_BADGE_COUNT + 1
|
||||
);
|
||||
$result[$section]['count'] = $count;
|
||||
$totals['count'] += $count;
|
||||
|
||||
$notifications = $this->notifMapper->fetchUnreadByUser( $this->mUser, 1, null, $eventTypesToLoad, null, $dbSource );
|
||||
$notifications = $this->notifMapper->fetchUnreadByUser(
|
||||
$this->mUser,
|
||||
1,
|
||||
null,
|
||||
$eventTypesToLoad,
|
||||
null,
|
||||
$dbSource
|
||||
);
|
||||
if ( $notifications ) {
|
||||
$notification = reset( $notifications );
|
||||
$timestamp = $notification->getTimestamp();
|
||||
|
@ -586,7 +617,10 @@ class MWEchoNotifUser {
|
|||
|
||||
$localTimestamp = $localData[$section]['timestamp'];
|
||||
$foreignTimestamp = $this->getForeignTimestamp( $section );
|
||||
$globalTimestamp = max( $localTimestamp, $foreignTimestamp ? $foreignTimestamp->getTimestamp( TS_MW ) : -1 );
|
||||
$globalTimestamp = max(
|
||||
$localTimestamp,
|
||||
$foreignTimestamp ? $foreignTimestamp->getTimestamp( TS_MW ) : -1
|
||||
);
|
||||
$result[$section]['timestamp'] = $globalTimestamp;
|
||||
$totals['timestamp'] = max( $totals['timestamp'], $globalTimestamp );
|
||||
}
|
||||
|
|
|
@ -90,7 +90,10 @@ class EchoNotifier {
|
|||
|
||||
// instant email notification
|
||||
$toAddress = MailAddress::newFromUser( $user );
|
||||
$fromAddress = new MailAddress( $wgPasswordSender, wfMessage( 'emailsender' )->inContentLanguage()->text() );
|
||||
$fromAddress = new MailAddress(
|
||||
$wgPasswordSender,
|
||||
wfMessage( 'emailsender' )->inContentLanguage()->text()
|
||||
);
|
||||
$replyAddress = new MailAddress( $wgNoReplyAddress );
|
||||
// Since we are sending a single email, should set the bundle hash to null
|
||||
// if it is set with a value from somewhere else
|
||||
|
|
|
@ -22,7 +22,10 @@ class ApiEchoMarkSeen extends ApiBase {
|
|||
$outputTimestamp = wfTimestamp( TS_ISO_8601, $timestamp );
|
||||
} else {
|
||||
// MW
|
||||
$this->addDeprecation( 'apiwarn-echo-deprecation-timestampformat', 'action=echomarkseen×tampFormat=MW' );
|
||||
$this->addDeprecation(
|
||||
'apiwarn-echo-deprecation-timestampformat',
|
||||
'action=echomarkseen×tampFormat=MW'
|
||||
);
|
||||
|
||||
$outputTimestamp = $timestamp;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,9 @@ class ApiEchoNotifications extends ApiQueryBase {
|
|||
|
||||
// if exactly 1 section is specified, we consider only that section, otherwise
|
||||
// we pass ALL to consider all foreign notifications
|
||||
$section = count( $params['sections'] ) === 1 ? reset( $params['sections'] ) : EchoAttributeManager::ALL;
|
||||
$section = count( $params['sections'] ) === 1
|
||||
? reset( $params['sections'] )
|
||||
: EchoAttributeManager::ALL;
|
||||
if ( $this->crossWikiSummary ) {
|
||||
$foreignNotification = $this->makeForeignNotification( $user, $params['format'], $section );
|
||||
if ( $foreignNotification ) {
|
||||
|
@ -386,7 +388,8 @@ class ApiEchoNotifications extends ApiQueryBase {
|
|||
|
||||
// Sort wikis by timestamp, in descending order (newest first)
|
||||
usort( $wikis, function ( $a, $b ) use ( $section, $timestampsByWiki ) {
|
||||
return (int)$timestampsByWiki[$b]->getTimestamp( TS_UNIX ) - (int)$timestampsByWiki[$a]->getTimestamp( TS_UNIX );
|
||||
return (int)$timestampsByWiki[$b]->getTimestamp( TS_UNIX )
|
||||
- (int)$timestampsByWiki[$a]->getTimestamp( TS_UNIX );
|
||||
} );
|
||||
|
||||
$row = new stdClass;
|
||||
|
|
|
@ -36,7 +36,8 @@ class EchoPageLinkedPresentationModel extends EchoEventPresentationModel {
|
|||
|
||||
public function getSecondaryLinks() {
|
||||
$whatLinksHereLink = [
|
||||
'url' => SpecialPage::getTitleFor( 'Whatlinkshere', $this->event->getTitle()->getPrefixedText() )->getFullURL(),
|
||||
'url' => SpecialPage::getTitleFor( 'Whatlinkshere', $this->event->getTitle()->getPrefixedText() )
|
||||
->getFullURL(),
|
||||
'label' => $this->msg( 'notification-link-text-what-links-here' )->text(),
|
||||
'description' => '',
|
||||
'icon' => 'linked',
|
||||
|
@ -48,7 +49,8 @@ class EchoPageLinkedPresentationModel extends EchoEventPresentationModel {
|
|||
if ( $revid !== null ) {
|
||||
$diffLink = [
|
||||
'url' => $this->getPageFrom()->getFullURL( [ 'diff' => $revid, 'oldid' => 'prev' ] ),
|
||||
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )->text(),
|
||||
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )
|
||||
->text(),
|
||||
'description' => '',
|
||||
'icon' => 'changes',
|
||||
'prioritized' => true
|
||||
|
|
|
@ -90,7 +90,10 @@ class SpecialNotificationsFormatter extends EchoEventFormatter {
|
|||
$html .= Xml::tags(
|
||||
'div',
|
||||
[ 'class' => 'mw-echo-notification-footer' ],
|
||||
implode( Html::element( 'span', [ 'class' => 'mw-echo-notification-footer-element' ], $pipe ), $footerItems )
|
||||
implode(
|
||||
Html::element( 'span', [ 'class' => 'mw-echo-notification-footer-element' ], $pipe ),
|
||||
$footerItems
|
||||
)
|
||||
) . "\n";
|
||||
|
||||
// Wrap everything in mw-echo-content class
|
||||
|
|
|
@ -43,7 +43,8 @@ class EchoWatchlistChangePresentationModel extends EchoEventPresentationModel {
|
|||
}
|
||||
return [
|
||||
'url' => $this->getViewChangesUrl(),
|
||||
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )->text(),
|
||||
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )
|
||||
->text(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -57,7 +58,8 @@ class EchoWatchlistChangePresentationModel extends EchoEventPresentationModel {
|
|||
} else {
|
||||
$viewChangesLink = [
|
||||
'url' => $this->getViewChangesUrl(),
|
||||
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )->text(),
|
||||
'label' => $this->msg( 'notification-link-text-view-changes', $this->getViewingUserForGender() )
|
||||
->text(),
|
||||
'description' => '',
|
||||
'icon' => 'changes',
|
||||
'prioritized' => true,
|
||||
|
|
|
@ -150,7 +150,11 @@ class EchoUserNotificationGateway {
|
|||
* @param int $cap Max count
|
||||
* @return int
|
||||
*/
|
||||
public function getCappedNotificationCount( $dbSource, array $eventTypesToLoad = [], $cap = MWEchoNotifUser::MAX_BADGE_COUNT ) {
|
||||
public function getCappedNotificationCount(
|
||||
$dbSource,
|
||||
array $eventTypesToLoad = [],
|
||||
$cap = MWEchoNotifUser::MAX_BADGE_COUNT
|
||||
) {
|
||||
// double check
|
||||
if ( !in_array( $dbSource, [ DB_REPLICA, DB_MASTER ] ) ) {
|
||||
$dbSource = DB_REPLICA;
|
||||
|
|
|
@ -17,8 +17,8 @@ class NotificationPager extends ReverseChronologicalPager {
|
|||
}
|
||||
|
||||
public function formatRow( $row ) {
|
||||
$msg = "This pager does not support row formatting. Use 'getNotifications()' to get a list of EchoNotification objects.";
|
||||
throw new Exception( $msg );
|
||||
throw new Exception( "This pager does not support row formatting. " .
|
||||
"Use 'getNotifications()' to get a list of EchoNotification objects." );
|
||||
}
|
||||
|
||||
public function getQueryInfo() {
|
||||
|
|
|
@ -84,7 +84,8 @@ class SpecialDisplayNotificationsConfiguration extends UnlistedSpecialPage {
|
|||
)
|
||||
)->parse();
|
||||
|
||||
$this->categoryNames[$internalCategoryName] = $formattedFriendlyCategoryName . ' ' . $formattedInternalCategoryName;
|
||||
$this->categoryNames[$internalCategoryName] = $formattedFriendlyCategoryName . ' '
|
||||
. $formattedInternalCategoryName;
|
||||
}
|
||||
|
||||
$this->flippedCategoryNames = array_flip( $this->categoryNames );
|
||||
|
@ -128,7 +129,13 @@ class SpecialDisplayNotificationsConfiguration extends UnlistedSpecialPage {
|
|||
* @param array $columnLabelMapping Associative array mapping label to tag
|
||||
* @param array $value Array consisting of strings in the format '$columnTag-$rowTag'
|
||||
*/
|
||||
protected function outputCheckMatrix( $id, $legendMsgKey, array $rowLabelMapping, array $columnLabelMapping, array $value ) {
|
||||
protected function outputCheckMatrix(
|
||||
$id,
|
||||
$legendMsgKey,
|
||||
array $rowLabelMapping,
|
||||
array $columnLabelMapping,
|
||||
array $value
|
||||
) {
|
||||
$form = new HTMLForm(
|
||||
[
|
||||
$id => [
|
||||
|
@ -174,7 +181,8 @@ class SpecialDisplayNotificationsConfiguration extends UnlistedSpecialPage {
|
|||
Html::rawElement(
|
||||
'li',
|
||||
[],
|
||||
$this->categoryNames[$categoryName] . $this->msg( 'colon-separator' )->escaped() . ' ' . $implodedTypes
|
||||
$this->categoryNames[$categoryName] . $this->msg( 'colon-separator' )->escaped() . ' '
|
||||
. $implodedTypes
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -199,7 +207,8 @@ class SpecialDisplayNotificationsConfiguration extends UnlistedSpecialPage {
|
|||
$types = $this->attributeManager->getEventsForSection( $section );
|
||||
// echo-notification-alert-text-only, echo-notification-notice-text-only
|
||||
$msgSection = $section == 'message' ? 'notice' : $section;
|
||||
$flippedSectionNames[$this->msg( 'echo-notification-' . $msgSection . '-text-only' )->escaped()] = $section;
|
||||
$flippedSectionNames[$this->msg( 'echo-notification-' . $msgSection . '-text-only' )->escaped()]
|
||||
= $section;
|
||||
foreach ( $types as $type ) {
|
||||
$bySectionValue[] = "$section-$type";
|
||||
}
|
||||
|
|
|
@ -22,7 +22,12 @@ class BackfillUnreadWikis extends Maintenance {
|
|||
|
||||
$rebuild = $this->hasOption( 'rebuild' );
|
||||
if ( $rebuild ) {
|
||||
$iterator = new BatchRowIterator( $dbFactory->getSharedDb( DB_REPLICA ), 'echo_unread_wikis', 'euw_user', $this->mBatchSize );
|
||||
$iterator = new BatchRowIterator(
|
||||
$dbFactory->getSharedDb( DB_REPLICA ),
|
||||
'echo_unread_wikis',
|
||||
'euw_user',
|
||||
$this->mBatchSize
|
||||
);
|
||||
$iterator->addConditions( [ 'euw_wiki' => wfWikiID() ] );
|
||||
} else {
|
||||
$userQuery = User::getQueryInfo();
|
||||
|
@ -54,7 +59,9 @@ class BackfillUnreadWikis extends Maintenance {
|
|||
$msgCount = $notifUser->getNotificationCount( EchoAttributeManager::MESSAGE, false );
|
||||
$msgUnread = $notifUser->getLastUnreadNotificationTime( EchoAttributeManager::MESSAGE, false );
|
||||
|
||||
if ( ( $alertCount !== 0 && $alertUnread === false ) || ( $msgCount !== 0 && $msgUnread === false ) ) {
|
||||
if ( ( $alertCount !== 0 && $alertUnread === false ) ||
|
||||
( $msgCount !== 0 && $msgUnread === false )
|
||||
) {
|
||||
// If there are alerts, there should be an alert timestamp (same for messages).
|
||||
|
||||
// Otherwise, there is a race condition between the two values, indicating there's already
|
||||
|
|
|
@ -19,8 +19,10 @@ class RecomputeNotifCounts extends Maintenance {
|
|||
parent::__construct();
|
||||
|
||||
$this->addDescription( 'Recompute notification counts for all users.' );
|
||||
$this->addOption( 'user-ids', 'Comma-separated list of users to recompute notification counts for', false, true );
|
||||
$this->addOption( 'notif-types', 'Recompute counts for all users who have unread notifications of one of these types (comma-separated)',
|
||||
$this->addOption( 'user-ids',
|
||||
'Comma-separated list of users to recompute notification counts for', false, true );
|
||||
$this->addOption( 'notif-types',
|
||||
'Recompute counts for all users who have unread notifications of one of these types (comma-separated)',
|
||||
false, true );
|
||||
|
||||
$this->setBatchSize( 500 );
|
||||
|
|
|
@ -18,8 +18,8 @@ class RemoveOrphanedEvents extends LoggedUpdateMaintenance {
|
|||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->addDescription( "Remove rows from echo_event and echo_target_page that don't have corresponding rows in " .
|
||||
"echo_notification or echo_email_batch" );
|
||||
$this->addDescription( "Remove rows from echo_event and echo_target_page that don't have corresponding " .
|
||||
"rows in echo_notification or echo_email_batch" );
|
||||
|
||||
$this->setBatchSize( 500 );
|
||||
|
||||
|
|
|
@ -274,8 +274,16 @@ class EchoAttributeManagerTest extends MediaWikiTestCase {
|
|||
'email' => true,
|
||||
]
|
||||
];
|
||||
$manager = new EchoAttributeManager( $notif, $category, $defaultNotifyTypeAvailability, $notifyTypeAvailabilityByCategory );
|
||||
$this->assertEquals( [ 'event_two', 'event_four' ], $manager->getUserEnabledEvents( $this->mockUser(), 'web' ) );
|
||||
$manager = new EchoAttributeManager(
|
||||
$notif,
|
||||
$category,
|
||||
$defaultNotifyTypeAvailability,
|
||||
$notifyTypeAvailabilityByCategory
|
||||
);
|
||||
$this->assertEquals(
|
||||
[ 'event_two', 'event_four' ],
|
||||
$manager->getUserEnabledEvents( $this->mockUser(), 'web' )
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetUserEnabledEventsbySections() {
|
||||
|
@ -322,7 +330,12 @@ class EchoAttributeManagerTest extends MediaWikiTestCase {
|
|||
'email' => true,
|
||||
]
|
||||
];
|
||||
$manager = new EchoAttributeManager( $notif, $category, $defaultNotifyTypeAvailability, $notifyTypeAvailabilityByCategory );
|
||||
$manager = new EchoAttributeManager(
|
||||
$notif,
|
||||
$category,
|
||||
$defaultNotifyTypeAvailability,
|
||||
$notifyTypeAvailabilityByCategory
|
||||
);
|
||||
$expected = [ 'event_one', 'event_three', 'event_four' ];
|
||||
$actual = $manager->getUserEnabledEventsbySections( $this->mockUser(), 'web', [ 'alert' ] );
|
||||
sort( $expected );
|
||||
|
|
|
@ -29,7 +29,8 @@ class EchoTalkPageFunctionalTest extends ApiTestCase {
|
|||
|
||||
// Ensure the proper event was created
|
||||
$events = $this->fetchAllEvents();
|
||||
$this->assertCount( 1 + $messageCount, $events, 'After initial edit a single event must exist.' ); // +1 is due to 0 index
|
||||
// +1 is due to 0 index
|
||||
$this->assertCount( 1 + $messageCount, $events, 'After initial edit a single event must exist.' );
|
||||
$row = array_shift( $events );
|
||||
$this->assertEquals( 'edit-user-talk', $row->event_type );
|
||||
$this->assertEventSectionTitle( 'Section 8', $row );
|
||||
|
|
|
@ -242,13 +242,21 @@ class NotificationControllerTest extends MediaWikiTestCase {
|
|||
* @dataProvider getEventNotifyTypesProvider
|
||||
*/
|
||||
public function testGetEventNotifyTypes(
|
||||
$message, $expect, $type, array $defaultNotifyTypeAvailability, array $notifyTypeAvailabilityByCategory, array $notifications
|
||||
$message,
|
||||
$expect,
|
||||
$type,
|
||||
array $defaultNotifyTypeAvailability,
|
||||
array $notifyTypeAvailabilityByCategory,
|
||||
array $notifications
|
||||
) {
|
||||
$this->setMwGlobals( [
|
||||
'wgDefaultNotifyTypeAvailability' => $defaultNotifyTypeAvailability,
|
||||
'wgNotifyTypeAvailabilityByCategory' => $notifyTypeAvailabilityByCategory,
|
||||
'wgEchoNotifications' => $notifications,
|
||||
'wgEchoNotificationCategories' => array_fill_keys( array_keys( $notifyTypeAvailabilityByCategory ), [ 'priority' => 4 ] ),
|
||||
'wgEchoNotificationCategories' => array_fill_keys(
|
||||
array_keys( $notifyTypeAvailabilityByCategory ),
|
||||
[ 'priority' => 4 ]
|
||||
),
|
||||
] );
|
||||
$result = EchoNotificationController::getEventNotifyTypes( $type );
|
||||
$this->assertEquals( $expect, $result, $message );
|
||||
|
|
Loading…
Reference in a new issue