resourceloader: Warn on ResourceLoader::construct without Config
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 10 Jun 2019 15:00:16 +0000 (16:00 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 10 Jun 2019 15:24:45 +0000 (15:24 +0000)
commitc9318edc2dd531d3d31e233665b92c2e303bdf01
treeeafbf2902810c683edc5b8ba7fd7597edf688ca2
parente2ef870ee2da2940dc69a9c69fd2572039a606d4
resourceloader: Warn on ResourceLoader::construct without Config

The only remaining use of 'new ResourceLoader' is in tests, which have
been migrated in this commit to either passing the real config explicitly
(for integration tests), or by passing a HashConfig from a new
'getMinimalConfig' method which has only the keys required for the tests
to pass (e.g. avoid any ConfigExeption for unknown keys).

Also clean up some related code quality issues:

* Migrate wfScript() to $conf->get() so that the local Config is used,
  instead of implicitly using global variables. This isn't deprecated for
  MediaWiki generally, but done here to prepare ResourceLoader for becoming
  a standalone library.

* Remove mocking of 'CacheEpoch' config, this is no longer used anywhere
  in ResourceLoader.

* Change EmptyResourceLoader to use the minimal config by default and
  remove code duplication by calling the parent.

  Update the small number of uses that are integration tests, to explicitly
  pass in the live config as needed. And for the one case that tests the
  'startup' module, it no longer needs to register it manually given this
  is part of ResourceLoader::__construct() by default.

Bug: T32956
Change-Id: I127346fd530fa66f205156e545758b1c29d0fac0
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderStartUpModule.php
tests/phpunit/ResourceLoaderTestCase.php
tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php
tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php