phpunit: Make LogFormatterTest less slow
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 14 Apr 2017 23:13:39 +0000 (16:13 -0700)
committerKrinkle <krinklemail@gmail.com>
Fri, 14 Apr 2017 23:44:23 +0000 (23:44 +0000)
commit8596a01658f30724463f8bee7ee07d2a26b8e58e
treeeffaab396a2c5eb2d3068035165fc03875773581
parent415a8de97dd07653a5f3aec239696be480e2d96a
phpunit: Make LogFormatterTest less slow

Right now it's quite slow because it reloads LocalisationCache
for every test case.

Change the reload to only happen once for the entire class.

Also use RequestContext instead of wgLang to match logic in
the parent class (MediaWikiLangTestCase).

$ phpunit includes/logging/LogFormatterTest.php
Before
- run 1) Time: 23.56 seconds, Memory: 48.00MB
- run 2) Time: 22.41 seconds, Memory: 48.75MB
After
- run 1) Time: 14.27 seconds, Memory: 47.50MB
- run 2) Time: 13.45 seconds, Memory: 47.25MB

Change-Id: Ia791563ca9094c36782acfe9826def45f2a1d621
tests/phpunit/includes/logging/LogFormatterTest.php