diff options
author | daniel <dkinzler@wikimedia.org> | 2023-10-19 23:13:26 +0200 |
---|---|---|
committer | daniel <dkinzler@wikimedia.org> | 2024-02-02 13:03:29 +0100 |
commit | 24d0aee05e614c38380010731188b816114d523b (patch) | |
tree | 46a72c06d7fccbacae740c223c138aa909e18141 /includes/MediaWiki.php | |
parent | 0ce2d4e7783610a15078e44aadd05ee5220e51b0 (diff) | |
download | mediawikicore-24d0aee05e614c38380010731188b816114d523b.tar.gz mediawikicore-24d0aee05e614c38380010731188b816114d523b.zip |
entrypoint: Isolate entry points from PHP runtime for testing
1) Introduce EntryPointEnvironment which wraps functions that interact
with the PHP runtime, so they can be mocked for testing.
2) Allow server info fields to be overwritten in FauxRequest.
3) Make MediaWikiEntryPoint use WebResponse to set headers
Bug: T354216
Change-Id: Ic21950c956de5d2b5a7dd66a1e2de58f807cfd9f
Diffstat (limited to 'includes/MediaWiki.php')
-rw-r--r-- | includes/MediaWiki.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 9ebab6e3139c..4fe5d48fa53d 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -20,6 +20,7 @@ * @file */ +use MediaWiki\EntryPointEnvironment; use MediaWiki\MediaWikiEntryPoint; use MediaWiki\MediaWikiServices; @@ -31,10 +32,14 @@ use MediaWiki\MediaWikiServices; */ class MediaWiki extends MediaWikiEntryPoint { - public function __construct( IContextSource $context = null ) { + public function __construct( + ?IContextSource $context = null, + ?EntryPointEnvironment $environment = null + ) { $context ??= RequestContext::getMain(); + $environment ??= new EntryPointEnvironment(); - parent::__construct( $context, MediaWikiServices::getInstance() ); + parent::__construct( $context, $environment, MediaWikiServices::getInstance() ); } /** |