- UserEditTrackerTest: determine whether to create the page based on
WikiPage::exists() instead of a method parameter. The current
implementation only works because the page is not deleted between test
runs, and the creation query is ignored. However, if the first call to
`editTrackerDoEdit` doesn't have $create=true, tests would fail. For
instance, testGetEditTimestamp would fail when run on its own because
the revision cannot be inserted if the page doesn't exist. Just use
WikiPage::exists instead of forcing callers to handle this correctly.
- DatabaseBlockTest: use addDBDataOnce instead of a DIY implementation.
This also makes the tests more deterministic, because the records
needed by the test class are created immediately. Also avoid redundant
User::addToDatabase and ::saveSettings, these are already done by
TestUser.
- PageRestrictionTest: avoid Title::newFromID which is not guaranteed to
succeed if all pages have been deleted by that point. The second part
of the test was effectively doing the same thing as the first part, so
just remove it.
- WikiPageDbTest: avoid expensive page deletions in tearDown. These are
all unnecessary because the DB is cleaned up after each test (and
'page' is explicitly included in $tablesUsed). In fact, deleting test
pages as done there can be even worse than not doing anything, because
it creates log entries etc. Add page_restrictions to tablesUsed as
that's not truncated automatically.
- DBSiteStoreTest: testReset would fail when run on its own because it
depends on test sites being inserted in testGetSites. Make the test
add the sites it needs, so that they can safely be cleared between
test runs.
Change-Id: I1065fb3e8507b4b1a3bf185181f2f3059a97fd04