diff --git a/extension.json b/extension.json index ecf8d5198..40c539d23 100644 --- a/extension.json +++ b/extension.json @@ -1057,16 +1057,10 @@ "manifest_version": 2, "AutoloadClasses": { "BackfillUnreadWikis": "maintenance/backfillUnreadWikis.php", - "Bundleable": "includes/Bundleable.php", - "Bundler": "includes/Bundler.php", - "EchoArrayList": "includes/EchoArrayList.php", "EchoAttributeManager": "includes/AttributeManager.php", "MediaWiki\\Extension\\Notifications\\AttributeManager": "includes/AttributeManager.php", - "EchoCachedList": "includes/EchoCachedList.php", "EchoCallbackIterator": "includes/Iterator/CallbackIterator.php", "MediaWiki\\Extension\\Notifications\\Iterator\\CallbackIterator": "includes/Iterator/CallbackIterator.php", - "EchoContainmentList": "includes/EchoContainmentList.php", - "EchoContainmentSet": "includes/EchoContainmentSet.php", "EchoDataOutputFormatter": "includes/DataOutputFormatter.php", "EchoDeferredMarkAsDeletedUpdate": "includes/DeferredMarkAsDeletedUpdate.php", "EchoDiffGroup": "includes/EchoDiffGroup.php", @@ -1075,8 +1069,6 @@ "MediaWiki\\Extension\\Notifications\\DiscussionParser": "includes/DiscussionParser.php", "EchoEditUserTalkPresentationModel": "includes/Formatters/EchoEditUserTalkPresentationModel.php", "MediaWiki\\Extension\\Notifications\\Formatters\\EchoEditUserTalkPresentationModel": "includes/Formatters/EchoEditUserTalkPresentationModel.php", - "EchoEmailFormat": "includes/EmailFormat.php", - "EchoEmailFrequency": "includes/EmailFrequency.php", "EchoEvent": "includes/Model/Event.php", "MediaWiki\\Extension\\Notifications\\Model\\Event": "includes/Model/Event.php", "EchoEventPresentationModel": "includes/Formatters/EchoEventPresentationModel.php", @@ -1093,10 +1085,8 @@ "MediaWiki\\Extension\\Notifications\\Mapper\\NotificationMapper": "includes/Mapper/NotificationMapper.php", "EchoNotifier": "includes/Notifier.php", "MediaWiki\\Extension\\Notifications\\Notifier": "includes/Notifier.php", - "EchoOnWikiList": "includes/EchoOnWikiList.php", "EchoPresentationModelSection": "includes/Formatters/EchoPresentationModelSection.php", "MediaWiki\\Extension\\Notifications\\Formatters\\EchoPresentationModelSection": "includes/Formatters/EchoPresentationModelSection.php", - "EchoSeenTime": "includes/SeenTime.php", "EchoServices": "includes/EchoServices.php", "EchoSummaryParser": "includes/EchoSummaryParser.php", "EchoSuppressionRowUpdateGenerator": "includes/schemaUpdate.php", @@ -1106,7 +1096,6 @@ "GenerateSampleNotifications": "maintenance/generateSampleNotifications.php", "MWEchoDbFactory": "includes/DbFactory.php", "MediaWiki\\Extension\\Notifications\\DbFactory": "includes/DbFactory.php", - "MWEchoEmailBatch": "includes/EmailBatch.php", "MWEchoEventLogging": "includes/EventLogging.php", "MWEchoNotifUser": "includes/NotifUser.php", "ProcessEchoEmailBatch": "maintenance/processEchoEmailBatch.php", @@ -1126,6 +1115,10 @@ "EchoAbstractMapperStub": "tests/phpunit/Mapper/EchoAbstractMapperStub.php", "EchoExecuteFirstArgumentStub": "tests/phpunit/Mapper/EchoExecuteFirstArgumentStub.php" }, + "TestAutoloadNamespaces": { + "MediaWiki\\Extension\\Notifications\\Test\\": "tests/phpunit/", + "MediaWiki\\Extension\\Notifications\\Test\\Integration\\": "tests/phpunit/integration/" + }, "ServiceWiringFiles": [ "ServiceWiring.php" ], diff --git a/includes/Api/ApiEchoMarkSeen.php b/includes/Api/ApiEchoMarkSeen.php index 8fc16fa55..4c6c8d438 100644 --- a/includes/Api/ApiEchoMarkSeen.php +++ b/includes/Api/ApiEchoMarkSeen.php @@ -5,7 +5,7 @@ namespace MediaWiki\Extension\Notifications\Api; // This is a GET module, not a POST module, for multi-DC support. See T222851. // Note that this module doesn't write to the database, only to the seentime cache. use ApiBase; -use EchoSeenTime; +use MediaWiki\Extension\Notifications\SeenTime; use Wikimedia\ParamValidator\ParamValidator; class ApiEchoMarkSeen extends ApiBase { @@ -21,7 +21,7 @@ class ApiEchoMarkSeen extends ApiBase { $params = $this->extractRequestParams(); $timestamp = wfTimestamp( TS_MW ); - $seenTime = EchoSeenTime::newFromUser( $user ); + $seenTime = SeenTime::newFromUser( $user ); $seenTime->setTime( $timestamp, $params['type'] ); if ( $params['timestampFormat'] === 'ISO_8601' ) { diff --git a/includes/Api/ApiEchoNotifications.php b/includes/Api/ApiEchoNotifications.php index 30191bf3e..b2feb6250 100644 --- a/includes/Api/ApiEchoNotifications.php +++ b/includes/Api/ApiEchoNotifications.php @@ -5,16 +5,16 @@ namespace MediaWiki\Extension\Notifications\Api; use ApiBase; use ApiQuery; use ApiQueryBase; -use Bundler; use Config; use EchoDataOutputFormatter; use EchoForeignNotifications; -use EchoSeenTime; use EchoServices; use MediaWiki\Extension\Notifications\AttributeManager; +use MediaWiki\Extension\Notifications\Bundler; use MediaWiki\Extension\Notifications\Controller\NotificationController; use MediaWiki\Extension\Notifications\Mapper\NotificationMapper; use MediaWiki\Extension\Notifications\Model\Notification; +use MediaWiki\Extension\Notifications\SeenTime; use MediaWiki\WikiMap\WikiMap; use MWEchoNotifUser; use Title; @@ -377,7 +377,7 @@ class ApiEchoNotifications extends ApiQueryBase { */ protected function getPropSeenTime( User $user, array $sections, $groupBySection ) { $result = []; - $seenTimeHelper = EchoSeenTime::newFromUser( $user ); + $seenTimeHelper = SeenTime::newFromUser( $user ); if ( $groupBySection ) { foreach ( $sections as $section ) { diff --git a/includes/EchoArrayList.php b/includes/ArrayList.php similarity index 71% rename from includes/EchoArrayList.php rename to includes/ArrayList.php index 7c2202108..ca79d33fd 100644 --- a/includes/EchoArrayList.php +++ b/includes/ArrayList.php @@ -1,11 +1,13 @@ getCacheKey() will be appended * to this to construct the cache key used. - * @param EchoContainmentList $nestedList The nested EchoContainmentList to cache the result of. + * @param ContainmentList $nestedList The nested EchoContainmentList to cache the result of. * @param int $timeout How long in seconds to cache the nested list, defaults to 1 week. */ public function __construct( WANObjectCache $cache, $partialCacheKey, - EchoContainmentList $nestedList, + ContainmentList $nestedList, $timeout = self::ONE_WEEK ) { $this->cache = $cache; diff --git a/includes/EchoContainmentList.php b/includes/ContainmentList.php similarity index 86% rename from includes/EchoContainmentList.php rename to includes/ContainmentList.php index e9032557d..60bac098e 100644 --- a/includes/EchoContainmentList.php +++ b/includes/ContainmentList.php @@ -1,9 +1,11 @@ addArray( $wgSomeGlobalParameter ); * $set->addOnWiki( NS_USER, 'Foo/bar-baz', $cache, 'some_user_specific_cache_key' ); * @@ -18,9 +23,9 @@ use MediaWiki\Preferences\MultiUsernameFilter; * ... * } */ -class EchoContainmentSet { +class ContainmentSet { /** - * @var EchoContainmentList[] + * @var ContainmentList[] */ protected $lists = []; @@ -37,11 +42,11 @@ class EchoContainmentSet { } /** - * Add an EchoContainmentList to the set of lists checked by self::contains() + * Add an ContainmentList to the set of lists checked by self::contains() * - * @param EchoContainmentList $list + * @param ContainmentList $list */ - public function add( EchoContainmentList $list ) { + public function add( ContainmentList $list ) { $this->lists[] = $list; } @@ -51,7 +56,7 @@ class EchoContainmentSet { * @param array $list */ public function addArray( array $list ) { - $this->add( new EchoArrayList( $list ) ); + $this->add( new ArrayList( $list ) ); } /** @@ -103,12 +108,12 @@ class EchoContainmentSet { public function addOnWiki( $namespace, $title, WANObjectCache $cache = null, $cacheKeyPrefix = '' ) { - $list = new EchoOnWikiList( $namespace, $title ); + $list = new OnWikiList( $namespace, $title ); if ( $cache ) { if ( $cacheKeyPrefix === '' ) { throw new BadMethodCallException( 'Cache requires providing a cache key prefix.' ); } - $list = new EchoCachedList( $cache, $cacheKeyPrefix, $list ); + $list = new CachedList( $cache, $cacheKeyPrefix, $list ); } $this->add( $list ); } diff --git a/includes/Controller/NotificationController.php b/includes/Controller/NotificationController.php index d372dd8b4..ced8af283 100644 --- a/includes/Controller/NotificationController.php +++ b/includes/Controller/NotificationController.php @@ -3,20 +3,20 @@ namespace MediaWiki\Extension\Notifications\Controller; use DeferredUpdates; -use EchoCachedList; -use EchoContainmentList; -use EchoContainmentSet; -use EchoOnWikiList; use EchoServices; use InvalidArgumentException; use Iterator; use MapCacheLRU; use MediaWiki\Extension\Notifications\AttributeManager; +use MediaWiki\Extension\Notifications\CachedList; +use MediaWiki\Extension\Notifications\ContainmentList; +use MediaWiki\Extension\Notifications\ContainmentSet; use MediaWiki\Extension\Notifications\Hooks\HookRunner; use MediaWiki\Extension\Notifications\Iterator\FilteredSequentialIterator; use MediaWiki\Extension\Notifications\Jobs\NotificationDeleteJob; use MediaWiki\Extension\Notifications\Jobs\NotificationJob; use MediaWiki\Extension\Notifications\Model\Event; +use MediaWiki\Extension\Notifications\OnWikiList; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use MediaWiki\Revision\RevisionStore; @@ -61,7 +61,7 @@ class NotificationController { /** * Echo event agent per wiki blacklist * - * @var EchoContainmentList|null + * @var ContainmentList|null */ protected static $wikiBlacklist; @@ -73,7 +73,7 @@ class NotificationController { protected static $whitelistByUser; /** - * Returns the count passed in, or MWEchoNotifUser::MAX_BADGE_COUNT + 1, + * Returns the count passed in, or NotifUser::MAX_BADGE_COUNT + 1, * whichever is less. * * @param int $count @@ -307,7 +307,7 @@ class NotificationController { // Ensure we have a blacklist for the user if ( !self::$blacklistByUser->has( (string)$user->getId() ) ) { - $blacklist = new EchoContainmentSet( $user ); + $blacklist = new ContainmentSet( $user ); // Add the config setting $blacklist->addArray( $wgEchoAgentBlacklist ); @@ -347,7 +347,7 @@ class NotificationController { self::$mutedPageLinkedTitlesCache = new MapCacheLRU( self::$maxUsersTitleCacheSize ); } if ( !self::$mutedPageLinkedTitlesCache->has( (string)$user->getId() ) ) { - $pageLinkedTitleMutedList = new EchoContainmentSet( $user ); + $pageLinkedTitleMutedList = new ContainmentSet( $user ); $pageLinkedTitleMutedList->addTitleIDsFromUserOption( 'echo-notifications-page-linked-title-muted-list' ); @@ -359,7 +359,7 @@ class NotificationController { } /** - * @return EchoContainmentList|null + * @return ContainmentList|null */ protected static function getWikiBlacklist() { global $wgEchoOnWikiBlacklist; @@ -368,10 +368,10 @@ class NotificationController { } if ( self::$wikiBlacklist === null ) { $clusterCache = MediaWikiServices::getInstance()->getMainWANObjectCache(); - self::$wikiBlacklist = new EchoCachedList( + self::$wikiBlacklist = new CachedList( $clusterCache, $clusterCache->makeKey( "echo_on_wiki_blacklist" ), - new EchoOnWikiList( NS_MEDIAWIKI, $wgEchoOnWikiBlacklist ) + new OnWikiList( NS_MEDIAWIKI, $wgEchoOnWikiBlacklist ) ); } @@ -406,7 +406,7 @@ class NotificationController { // Ensure we have a whitelist for the user if ( !self::$whitelistByUser->has( (string)$userId ) ) { - $whitelist = new EchoContainmentSet( $user ); + $whitelist = new ContainmentSet( $user ); self::$whitelistByUser->set( (string)$userId, $whitelist ); $whitelist->addOnWiki( NS_USER, diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php index 10d5176ab..1bdf7f350 100644 --- a/includes/EmailBatch.php +++ b/includes/EmailBatch.php @@ -1,6 +1,10 @@ userOptionsManager->getOption( $this->mUser, 'echo-email-frequency' ) - == EchoEmailFrequency::WEEKLY_DIGEST + == EmailFrequency::WEEKLY_DIGEST ) { $frequency = 'weekly'; $emailDeliveryMode = 'weekly_digest'; @@ -342,7 +351,7 @@ class MWEchoEmailBatch { } $format = MWEchoNotifUser::newFromUser( $this->mUser )->getEmailFormat(); - if ( $format == EchoEmailFormat::HTML ) { + if ( $format == EmailFormat::HTML ) { $htmlEmailDigestFormatter = new EchoHtmlDigestEmailFormatter( $this->mUser, $this->language, $frequency ); $htmlContent = $htmlEmailDigestFormatter->format( $this->events, 'email' ); diff --git a/includes/EmailFormat.php b/includes/EmailFormat.php index 608d0504b..de5bf9d07 100644 --- a/includes/EmailFormat.php +++ b/includes/EmailFormat.php @@ -1,6 +1,8 @@ EchoEmailFrequency::NEVER, - 'echo-pref-email-frequency-immediately' => EchoEmailFrequency::IMMEDIATELY, + 'echo-pref-email-frequency-never' => EmailFrequency::NEVER, + 'echo-pref-email-frequency-immediately' => EmailFrequency::IMMEDIATELY, ]; // Only show digest options if email batch is enabled if ( $wgEchoEnableEmailBatch ) { $freqOptions += [ - 'echo-pref-email-frequency-daily' => EchoEmailFrequency::DAILY_DIGEST, - 'echo-pref-email-frequency-weekly' => EchoEmailFrequency::WEEKLY_DIGEST, + 'echo-pref-email-frequency-daily' => EmailFrequency::DAILY_DIGEST, + 'echo-pref-email-frequency-weekly' => EmailFrequency::WEEKLY_DIGEST, ]; } $preferences['echo-email-frequency'] = [ @@ -359,12 +356,12 @@ class Hooks implements // Email format $preferences['echo-email-format'] = [ 'type' => 'select', - 'default' => EchoEmailFormat::HTML, + 'default' => EmailFormat::HTML, 'label-message' => 'echo-pref-email-format', 'section' => 'echo/emailsettings', 'options-messages' => [ - 'echo-pref-email-format-html' => EchoEmailFormat::HTML, - 'echo-pref-email-format-plain-text' => EchoEmailFormat::PLAIN_TEXT, + 'echo-pref-email-format-html' => EmailFormat::HTML, + 'echo-pref-email-format-plain-text' => EmailFormat::PLAIN_TEXT, ] ]; } @@ -714,7 +711,7 @@ class Hooks implements ] ); } - $seenTime = EchoSeenTime::newFromUser( $user ); + $seenTime = SeenTime::newFromUser( $user ); // Set seen time to UNIX epoch, so initially all notifications are unseen. $seenTime->setTime( wfTimestamp( TS_MW, 1 ), 'all' ); @@ -1017,7 +1014,7 @@ class Hooks implements $msgNotificationTimestamp = $notifUser->getLastUnreadMessageTime(); $alertNotificationTimestamp = $notifUser->getLastUnreadAlertTime(); - $seenTime = EchoSeenTime::newFromUser( $user ); + $seenTime = SeenTime::newFromUser( $user ); if ( $title->isSpecial( 'Notifications' ) ) { // If this is the Special:Notifications page, seenTime to now $seenTime->setTime( wfTimestamp( TS_MW ), AttributeManager::ALL ); @@ -1222,7 +1219,7 @@ class Hooks implements public function onOutputPageCheckLastModified( &$modifiedTimes, $out ) { $req = $out->getRequest(); if ( $req->getRawVal( 'action' ) === 'raw' || $req->getRawVal( 'action' ) === 'render' ) { - // Optimisation: Avoid expensive EchoSeenTime compute on non-skin responses (T279213) + // Optimisation: Avoid expensive SeenTime compute on non-skin responses (T279213) return; } @@ -1234,8 +1231,8 @@ class Hooks implements $modifiedTimes['notifications-global'] = $lastUpdate; } - $modifiedTimes['notifications-seen-alert'] = EchoSeenTime::newFromUser( $user )->getTime( 'alert' ); - $modifiedTimes['notifications-seen-message'] = EchoSeenTime::newFromUser( $user )->getTime( 'message' ); + $modifiedTimes['notifications-seen-alert'] = SeenTime::newFromUser( $user )->getTime( 'alert' ); + $modifiedTimes['notifications-seen-message'] = SeenTime::newFromUser( $user )->getTime( 'message' ); } } diff --git a/includes/Model/Event.php b/includes/Model/Event.php index 7a9ca81f0..be3954a84 100644 --- a/includes/Model/Event.php +++ b/includes/Model/Event.php @@ -2,10 +2,10 @@ namespace MediaWiki\Extension\Notifications\Model; -use Bundleable; use EchoServices; use Exception; use InvalidArgumentException; +use MediaWiki\Extension\Notifications\Bundleable; use MediaWiki\Extension\Notifications\Controller\NotificationController; use MediaWiki\Extension\Notifications\DbFactory; use MediaWiki\Extension\Notifications\Hooks\HookRunner; diff --git a/includes/Model/Notification.php b/includes/Model/Notification.php index ca5c0ce43..db840e7e7 100644 --- a/includes/Model/Notification.php +++ b/includes/Model/Notification.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\Notifications\Model; -use Bundleable; use InvalidArgumentException; +use MediaWiki\Extension\Notifications\Bundleable; use MediaWiki\Extension\Notifications\Hooks\HookRunner; use MediaWiki\Extension\Notifications\Mapper\NotificationMapper; use MediaWiki\MediaWikiServices; diff --git a/includes/NotifUser.php b/includes/NotifUser.php index 87cc6aab2..9da1ae7fe 100644 --- a/includes/NotifUser.php +++ b/includes/NotifUser.php @@ -2,6 +2,7 @@ use MediaWiki\Extension\Notifications\AttributeManager; use MediaWiki\Extension\Notifications\DbFactory; +use MediaWiki\Extension\Notifications\EmailFormat; use MediaWiki\Extension\Notifications\Gateway\UserNotificationGateway; use MediaWiki\Extension\Notifications\Mapper\NotificationMapper; use MediaWiki\Extension\Notifications\Mapper\TargetPageMapper; @@ -681,7 +682,7 @@ class MWEchoNotifUser { return $this->userOptionsLookup->getOption( $this->mUser, 'echo-email-format' ); } - return EchoEmailFormat::PLAIN_TEXT; + return EmailFormat::PLAIN_TEXT; } /** diff --git a/includes/Notifier.php b/includes/Notifier.php index 1a13103a6..428b620cf 100644 --- a/includes/Notifier.php +++ b/includes/Notifier.php @@ -2,7 +2,6 @@ namespace MediaWiki\Extension\Notifications; -use EchoEmailFormat; use EchoServices; use MailAddress; use MediaWiki\Extension\Notifications\Formatters\EchoHtmlEmailFormatter; @@ -11,7 +10,6 @@ use MediaWiki\Extension\Notifications\Hooks\HookRunner; use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\Extension\Notifications\Model\Notification; use MediaWiki\MediaWikiServices; -use MWEchoEmailBatch; use MWEchoEventLogging; use MWEchoNotifUser; use User; @@ -97,7 +95,7 @@ class Notifier { if ( !$bundleHash ) { $bundleHash = md5( $event->getType() . '-' . $event->getId() ); } - MWEchoEmailBatch::addToQueue( $user->getId(), $event->getId(), $priority, $bundleHash ); + EmailBatch::addToQueue( $user->getId(), $event->getId(), $priority, $bundleHash ); return true; } @@ -144,7 +142,7 @@ class Notifier { return false; } - if ( $emailFormat === EchoEmailFormat::HTML ) { + if ( $emailFormat === EmailFormat::HTML ) { $htmlEmailFormatter = new EchoHtmlEmailFormatter( $user, $lang ); $htmlContent = $htmlEmailFormatter->format( $event, 'email' ); $multipartBody = [ diff --git a/includes/EchoOnWikiList.php b/includes/OnWikiList.php similarity index 79% rename from includes/EchoOnWikiList.php rename to includes/OnWikiList.php index adfbb8f2b..020b83137 100644 --- a/includes/EchoOnWikiList.php +++ b/includes/OnWikiList.php @@ -1,15 +1,19 @@ getMainConfig()->get( 'EchoSeenTimeCacheType' ); if ( $cacheConfig === null ) { - // EchoHooks::initEchoExtension sets EchoSeenTimeCacheType to $wgMainStash if it's + // Hooks::initEchoExtension sets EchoSeenTimeCacheType to $wgMainStash if it's // null, so this can only happen if $wgMainStash is also null throw new UnexpectedValueException( 'Either $wgEchoSeenTimeCacheType or $wgMainStash must be set' diff --git a/includes/Special/SpecialNotifications.php b/includes/Special/SpecialNotifications.php index 6a830dd63..cfae7b2d1 100644 --- a/includes/Special/SpecialNotifications.php +++ b/includes/Special/SpecialNotifications.php @@ -3,9 +3,9 @@ namespace MediaWiki\Extension\Notifications\Special; use EchoDataOutputFormatter; -use EchoSeenTime; use Html; use MediaWiki\Extension\Notifications\OOUI\LabelIconWidget; +use MediaWiki\Extension\Notifications\SeenTime; use MWEchoEventLogging; use MWEchoNotifUser; use OOUI; @@ -78,8 +78,7 @@ class SpecialNotifications extends SpecialPage { // Add the notifications to the page (interspersed with date headers) $dateHeader = ''; $anyUnread = false; - $echoSeenTime = EchoSeenTime::newFromUser( $user ); - $seenTime = $echoSeenTime->getTime(); + $seenTime = SeenTime::newFromUser( $user )->getTime(); $notifArray = []; foreach ( $notif as $row ) { if ( !$row['*'] ) { diff --git a/maintenance/processEchoEmailBatch.php b/maintenance/processEchoEmailBatch.php index 07779f6c5..e07c208b5 100644 --- a/maintenance/processEchoEmailBatch.php +++ b/maintenance/processEchoEmailBatch.php @@ -1,6 +1,7 @@ eeb_user_id ); if ( $userId && $userId > $startUserId ) { - $emailBatch = MWEchoEmailBatch::newFromUserId( $userId, !$ignoreConfiguredSchedule ); + $emailBatch = EmailBatch::newFromUserId( $userId, !$ignoreConfiguredSchedule ); if ( $emailBatch ) { $this->output( "processing user_Id " . $userId . " \n" ); $emailBatch->process(); diff --git a/tests/phpunit/ContainmentSetTest.php b/tests/phpunit/ContainmentSetTest.php index b2f25b396..bb687efa6 100644 --- a/tests/phpunit/ContainmentSetTest.php +++ b/tests/phpunit/ContainmentSetTest.php @@ -1,14 +1,24 @@ getUser() ); + $list = new ContainmentSet( self::getTestUser()->getUser() ); $list->addArray( [ 'foo', 'bar' ] ); $this->assertTrue( $list->contains( 'foo' ) ); @@ -30,13 +40,13 @@ class ContainmentSetTest extends MediaWikiIntegrationTestCase { $inner = [ 'bing', 'bang' ]; // We use a mock instead of the real thing for the $this->once() assertion // verifying that the cache doesn't just keep asking the inner object - $list = $this->createMock( EchoArrayList::class ); + $list = $this->createMock( ArrayList::class ); $list->expects( $this->once() ) ->method( 'getValues' ) ->willReturn( $inner ); $list->method( 'getCacheKey' )->willReturn( '' ); - $cached = new EchoCachedList( $wanCache, 'test_key', $list ); + $cached = new CachedList( $wanCache, 'test_key', $list ); // First run through should hit the main list, and save to innerCache $this->assertEquals( $inner, $cached->getValues() ); @@ -44,7 +54,7 @@ class ContainmentSetTest extends MediaWikiIntegrationTestCase { // Reinitialize to get a fresh instance that will pull directly from // innerCache without hitting the $list - $freshCached = new EchoCachedList( $wanCache, 'test_key', $list ); + $freshCached = new CachedList( $wanCache, 'test_key', $list ); $this->assertEquals( $inner, $freshCached->getValues() ); } @@ -54,7 +64,7 @@ class ContainmentSetTest extends MediaWikiIntegrationTestCase { public function testOnWikiList() { $this->editPage( 'User:Foo/Bar-baz', "abc\ndef\r\nghi\n\n\n" ); - $list = new EchoOnWikiList( NS_USER, "Foo/Bar-baz" ); + $list = new OnWikiList( NS_USER, "Foo/Bar-baz" ); $this->assertEquals( [ 'abc', 'def', 'ghi' ], $list->getValues() @@ -62,7 +72,7 @@ class ContainmentSetTest extends MediaWikiIntegrationTestCase { } public function testOnWikiListNonExistant() { - $list = new EchoOnWikiList( NS_USER, "Some_Non_Existant_Page" ); + $list = new OnWikiList( NS_USER, "Some_Non_Existant_Page" ); $this->assertEquals( [], $list->getValues() ); } } diff --git a/tests/phpunit/MWEchoNotifUserTest.php b/tests/phpunit/MWEchoNotifUserTest.php index 106c8d828..9c97c0318 100644 --- a/tests/phpunit/MWEchoNotifUserTest.php +++ b/tests/phpunit/MWEchoNotifUserTest.php @@ -1,5 +1,6 @@ setMwGlobals( 'wgAllowHTMLEmail', true ); $this->assertEquals( $notifUser->getEmailFormat(), $pref ); $this->setMwGlobals( 'wgAllowHTMLEmail', false ); - $this->assertEquals( EchoEmailFormat::PLAIN_TEXT, $notifUser->getEmailFormat() ); + $this->assertEquals( EmailFormat::PLAIN_TEXT, $notifUser->getEmailFormat() ); } public function testMarkRead() { diff --git a/tests/phpunit/integration/EchoContainmentSetTest.php b/tests/phpunit/integration/ContainmentSetTest.php similarity index 72% rename from tests/phpunit/integration/EchoContainmentSetTest.php rename to tests/phpunit/integration/ContainmentSetTest.php index f2b194cf4..dd4368abd 100644 --- a/tests/phpunit/integration/EchoContainmentSetTest.php +++ b/tests/phpunit/integration/ContainmentSetTest.php @@ -1,11 +1,16 @@ createMock( UserOptionsLookup::class ); $userOptionsLookupMock->method( 'getOption' )->willReturn( $prefData ); $this->setService( 'UserOptionsLookup', $userOptionsLookupMock ); - $containmentSet = new EchoContainmentSet( $this->createMock( User::class ) ); + $containmentSet = new ContainmentSet( $this->createMock( User::class ) ); $containmentSet->addTitleIDsFromUserOption( 'preference-name' ); $this->assertSame( $expected, $containmentSet->contains( $contains ) ); } diff --git a/tests/phpunit/unit/BundlerTest.php b/tests/phpunit/unit/BundlerTest.php index 5a6bba9dc..b3c0a810d 100644 --- a/tests/phpunit/unit/BundlerTest.php +++ b/tests/phpunit/unit/BundlerTest.php @@ -1,9 +1,10 @@