Problem/Motivation
Follow up to #3129043: Move core database drivers to modules of their own and to #3230714-11: ConnectionUnitTest should be skipped for any database not psql or mysql:
Once #3129043: Move core database drivers to modules of their own is complete, it would be good to split the Database tests in 'core' ones and 'driver specific' ones, with the 'driver specifc' ones running dependent on the db driver in use by the SUT.
Proposed resolution
At the moment we have 4 possible solutions:
1: From the MR. Split Database tests in 'core' ones and 'driver specific' ones for the kerneltests in Drupal\KernelTests\Core\Database
only. For most contrib database drivers this is enough, only for the one for MongoDB this is not the case.
2: No patch/MR. Move the core/phpunit.xml.dist
file to the root of the database driver module and let every module with a database driver have its own phpunit.xml.dist
. Use that file for the testbot and in that file the tests that must be skipped for the module can be added to the file. The Drupal testbot must be changed for this to work. The advantage is that all tests can be overridden.
3: From the patch (comment #18): Change the class Drupal\Core\Test\TestDiscovery
, so that the methodgetTestClasses()
only returns the tests that need to be run. It skips the tests from the modules with a database driver that is not fromthe active database connection. The script run-tests.sh
will need to be changed a bit and the option "--list" will need the "--dburl" to have it return the correct list of test classes.
4: From the patch (coomment #19): The method Drupal\KernelTests\KernelTestBase::setUp()
now has code that skips tests that are from module with a database driver that is not from the active database connection and it skips tests that have been overridden by the module with the databse driver that is used in the active database connection. It only works for kerneltests, but the same solution can also be used for browsertests.
This issue implements option #1.