Avoid rebuilding database fixtures for every test run
authordaniel <daniel.kinzler@wikimedia.de>
Mon, 7 Mar 2016 17:26:25 +0000 (18:26 +0100)
committerKrinkle <krinklemail@gmail.com>
Thu, 10 Mar 2016 23:44:34 +0000 (23:44 +0000)
commita8995619c1bc0c0880962a266a0398bc87d1b7ae
tree458ecfe9020fbecfef84535c01ffc64c989d045b
parentd876c99123b7c07730b7a21fdff02649f75a7597
Avoid rebuilding database fixtures for every test run

This reduces the runtime of database-bound tests by about 40%
(on my system, from 4:55 to 2:47; results from Jenkins are
inconclusive).

The basic idea is to call addCoreDBData() only once, and have
a addDBDataOnce() that is called once per test class, not for
every test method lie addDBData() is. Most tests could be
trivially be changed to implement addDBDataOnce() instead of
addDBData(). The ones for which this did not work immediately
were left out for now. A closer look at the tests that still
implement addDBData() may reveal additional potential for
improvement.

TODO: Once this is merged, try to change addDBData() to
addDBDataOnce() where possible in extensions.

Change-Id: Iec4ed4c8419fb4ad87e6710de808863ede9998b7
20 files changed:
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/BlockTest.php
tests/phpunit/includes/MergeHistoryTest.php
tests/phpunit/includes/PrefixSearchTest.php
tests/phpunit/includes/RevisionStorageTest.php
tests/phpunit/includes/api/ApiBlockTest.php
tests/phpunit/includes/api/query/ApiQueryBasicTest.php
tests/phpunit/includes/api/query/ApiQueryContinue2Test.php
tests/phpunit/includes/api/query/ApiQueryContinueTest.php
tests/phpunit/includes/cache/GenderCacheTest.php
tests/phpunit/includes/cache/MessageCacheTest.php
tests/phpunit/includes/changes/CategoryMembershipChangeTest.php
tests/phpunit/includes/db/DatabaseSqliteTest.php
tests/phpunit/includes/deferred/LinksUpdateTest.php
tests/phpunit/includes/jobqueue/jobs/CategoryMembershipChangeJobTest.php
tests/phpunit/includes/parser/NewParserTest.php
tests/phpunit/includes/search/SearchEnginePrefixTest.php
tests/phpunit/includes/search/SearchEngineTest.php
tests/phpunit/includes/session/BotPasswordSessionProviderTest.php
tests/phpunit/includes/specials/SpecialMyLanguageTest.php