In parserTests.php, fix upload directory handling
authorTim Starling <tstarling@wikimedia.org>
Mon, 7 Sep 2015 06:10:12 +0000 (16:10 +1000)
committerTim Starling <tstarling@wikimedia.org>
Mon, 28 Sep 2015 05:48:32 +0000 (15:48 +1000)
commit75d7731ddea6801b1f45c2afd909fe62fecc1350
tree858e4ecbb5f92494b19fbe346f2e98992d6fd333
parentc847ed332e0720003c174d3fb813a3c4ca400416
In parserTests.php, fix upload directory handling

Instead of having two conflicting filerepo configurations, one at
/tmp/test-repo and another at a randomized path, and populating the one
that isn't used with files, let's just have a single upload directory,
populate it with files, and then actually use those files.

This fixes a set of confusing system-dependent parser test failures. In
the failure scenario, the file upload would be recorded, but then
invalid JPEG metadata would trigger LocalFile::loadFromFile(), which
would look for the file in the wrong place and mark it missing. Then
parser tests would fail due to image links being broken (red).

This is probably not as nice as the fake in-memory repo used by
NewParserTest, but this approach does provide a richer integration test.
This is a conservative fix that just fixes the things that are terribly
broken rather than making new things.

Also:

* Clear the RepoGroup singleton, for completeness, since it doesn't
  make sense to set $wgLocalRepo without clearing it. Since we now set up
  a similar repo at initialisation to the one set up with each test, it
  probably doesn't have any effect.

* Warn if gd is not present since this causes 49 test failures.

* Use glob patterns in teardownUploadDir() instead of requiring every
  file to be individually listed. This fixes an error due to failure to
  delete a 240px file.

Change-Id: I56a0e0d1cb363b40cf19c735e00cbb8929c1401a
tests/parser/parserTest.inc