aboutsummaryrefslogtreecommitdiffstats
path: root/includes/rcfeed
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2022-03-03 18:26:26 +0000
committerTimo Tijhof <krinkle@fastmail.com>2022-03-03 18:26:26 +0000
commit780930fa6b980a13a293858f4372b7da7cbe5115 (patch)
tree7774b90883e61cc80acd319d8a3ae209861245ea /includes/rcfeed
parentbeef2dc2db429c055216687234b38f8f63af92de (diff)
downloadmediawikicore-780930fa6b980a13a293858f4372b7da7cbe5115.tar.gz
mediawikicore-780930fa6b980a13a293858f4372b7da7cbe5115.zip
rcfeed: Allow easy mocking of RCFeed::factory objects
This matches what the RecentChange::getEngine method provides, which is deprecated and replaced by this. However, in order to update tests (such as those in EventBus) to the new method, that method first has to support mocking of this kind. Bug: T250628 Change-Id: I126f7c8b117b5d2e66a41ebb314523083e764547
Diffstat (limited to 'includes/rcfeed')
-rw-r--r--includes/rcfeed/RCFeed.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/rcfeed/RCFeed.php b/includes/rcfeed/RCFeed.php
index 284f68a2da2d..f0032bcbf679 100644
--- a/includes/rcfeed/RCFeed.php
+++ b/includes/rcfeed/RCFeed.php
@@ -51,6 +51,9 @@ abstract class RCFeed {
return RecentChange::getEngine( $params['uri'], $params );
}
$class = $params['class'];
+ if ( defined( 'MW_PHPUNIT_TEST' ) && is_object( $class ) ) {
+ return $class;
+ }
if ( !class_exists( $class ) ) {
throw new Exception( "Unknown class '$class'." );
}