resourceloader: Fix WikiModule preload to support localised titles
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 14 Sep 2016 21:14:31 +0000 (14:14 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 14 Sep 2016 21:54:01 +0000 (14:54 -0700)
commitdbe592df6d1914eb5d9a57c66792cbf4d59e3be7
tree103664ae840207b24f38c4341616c20633d41bed
parent1f73d635f85bca0791775855573a503802fe881b
resourceloader: Fix WikiModule preload to support localised titles

Follows-up 6f8dc27ca2 and dbd11e04aa. You'd expect a bug in preloading
to fallback to fetching it on-demand but due to a title format mismatch
the preload method did use the same title format for the cache key, but
not the same title format for discovering the results. As such, it set
the right cache key to an empty array.

* Make relevant methods testable and mockable.
* Add regression test.
* Change call to array_interect_key to use the same format as
  fetchTitleInfo(): Normalised title keys from Title::getPrefixedText.
  Previously, the intersect used the declared titles from getPages() which
  are not localised - causing an empty array to be returned from the
  intersect on wikis where the namespace name is localised.

Bug: T145673
Change-Id: Ibe788157724d73c727b9e2127b6828db32ca9420
includes/resourceloader/ResourceLoaderWikiModule.php
tests/phpunit/ResourceLoaderTestCase.php
tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php