Fix core DB data in unit testing
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 11 Apr 2016 17:36:38 +0000 (13:36 -0400)
committerGergő Tisza <gtisza@wikimedia.org>
Tue, 12 Apr 2016 16:58:44 +0000 (16:58 +0000)
commita754d43c066140c4ee41abeac978ec1fccf165ed
tree5cff5f4d2eff325eccf3a5a83d7d9a77e05c5400
parent5de06d021b0fa0ce3745eb1df867e41a25e5255a
Fix core DB data in unit testing

Iec4ed4c8 made it so addCoreDBData() only gets called once. Which is
nice, except for the fact that it means any test that puts
'user_groups' into $this->tablesUsed is going to cause UTSysop to no
longer be a sysop, so any later test that expects it to be one is going
to mysteriously fail.

The fix is to make resetDB() actually clear out the 'user' table when
requested, but then to re-call addCoreDBData() so UTSysop is still
there.

This might break extension tests if they're relying on the 'user' table
never being cleared even if it's specified in $this->tablesUsed, but
hopefully that's not often the case.

Bug: T132411
Change-Id: If251739fd486544f54a0c07edcc24aeef0998342
Depends-On: I0546a4f18e0751d209b6b7c6cd42973f25828313
Depends-On: I4924ae941b3844b39dd3f44c6986c3bf29b0d62a
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/api/ApiTestCase.php