Clarify MediaWikiTestCase::getSchemaOverrides()
authorLucas Werkmeister <lucas.werkmeister@wikimedia.de>
Mon, 27 May 2019 14:59:05 +0000 (16:59 +0200)
committerLucas Werkmeister <lucas.werkmeister@wikimedia.de>
Mon, 27 May 2019 14:59:05 +0000 (16:59 +0200)
I assumed that the 'create', 'drop' and 'alter' fields could be used to
limit the effect of a larger schema update when a test only uses a part
of it; debugging the resulting errors wasted a lot of time. Perhaps this
will help to prevent others from making the same mistake.

Change-Id: Iffa661ff0d967b593897667a081ee6e1399e4701

tests/phpunit/MediaWikiTestCase.php

index 486b16d..874fc45 100644 (file)
@@ -1596,6 +1596,10 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase {
         * Stub. If a test suite needs to test against a specific database schema, it should
         * override this method and return the appropriate information from it.
         *
+        * 'create', 'drop' and 'alter' in the returned array should list all the tables affected
+        * by the 'scripts', even if the test is only interested in a subset of them, otherwise
+        * the overrides may not be fully cleaned up, leading to errors later.
+        *
         * @param IMaintainableDatabase $db The DB connection to use for the mock schema.
         *        May be used to check the current state of the schema, to determine what
         *        overrides are needed.