X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderContext.php;h=372d12dd85013ed030d0f7b52a3641f6298b9405;hb=f39a906df0d8c8d32956b7b19b6bdb5a60c7bd93;hp=57392b97f83ecc3f44d16f24fc5c26daebe6095d;hpb=f186496005a47a09aed6d46feea7302fe9d5f0e2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index 57392b97f8..372d12dd85 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -63,7 +63,7 @@ class ResourceLoaderContext implements MessageLocalizer { $this->request = $request; $this->logger = $resourceLoader->getLogger(); - // Future developers: Use WebRequest::getRawVal() instead getVal(). + // Future developers: Use WebRequest::getRawVal() instead of getVal(). // The getVal() method performs slow Language+UTF logic. (f303bb9360) // List of modules @@ -72,10 +72,7 @@ class ResourceLoaderContext implements MessageLocalizer { // Various parameters $this->user = $request->getRawVal( 'user' ); - $this->debug = $request->getFuzzyBool( - 'debug', - $this->getConfig()->get( 'ResourceLoaderDebug' ) - ); + $this->debug = $request->getRawVal( 'debug' ) === 'true'; $this->only = $request->getRawVal( 'only', null ); $this->version = $request->getRawVal( 'version', null ); $this->raw = $request->getFuzzyBool( 'raw' ); @@ -133,9 +130,18 @@ class ResourceLoaderContext implements MessageLocalizer { /** * Return a dummy ResourceLoaderContext object suitable for passing into * things that don't "really" need a context. + * + * Use cases: + * - Unit tests (deprecated, create empty instance directly or use RLTestCase). + * * @return ResourceLoaderContext */ public static function newDummyContext() { + // This currently creates a non-empty instance of ResourceLoader (all modules registered), + // but that's probably not needed. So once that moves into ServiceWiring, this'll + // become more like the EmptyResourceLoader class we have in PHPUnit tests, which + // is what this should've had originally. If this turns out to be untrue, change to: + // `MediaWikiServices::getInstance()->getResourceLoader()` instead. return new self( new ResourceLoader( MediaWikiServices::getInstance()->getMainConfig(), LoggerFactory::getInstance( 'resourceloader' )