Introduce DB schema overrides for unit tests.
authordaniel <daniel.kinzler@wikimedia.de>
Thu, 16 Nov 2017 16:48:25 +0000 (17:48 +0100)
committerAddshore <addshorewiki@gmail.com>
Fri, 5 Jan 2018 16:23:55 +0000 (16:23 +0000)
commit047151c6924de280b736de64e76faacd6bb7d539
treeb90735741c6660f8a7c15bcec45d4bae1cdf6699
parentc8a852fd34aac8ae61e6351be832c22155ddd633
Introduce DB schema overrides for unit tests.

This introduces MediaWikiTestCase::getSchemaOverrides,  which can be overwritten
to return information about which tables are going to be altered, and which SQL
files should be used to set up the target schema. This allows tests for a class
that interacts with the database can have a subclass for each supported database
schema.

NOTE: this has only been tested with MySQL.

Bug: T180705
Change-Id: I7a4071072d802a82ecf7d16fbf8882ff8c79287f
includes/db/CloneDatabase.php
includes/libs/rdbms/database/Database.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php [new file with mode: 0644]
tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php [new file with mode: 0644]
tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql [new file with mode: 0644]
tests/phpunit/tests/MediaWikiTestCaseTest.php