Hi all
Phpunit tests that use the database should use @group Database. But that makes
them extremely slow. I'd like to elevate this problem. Here's the situation:
@group Database does two things, as far as I understand:
* MediaWikiTestCase will notice this group and use temporary tables instead of
the wiki database's actual tables. The temporary tables are re-created for every
test. This protected the wiki from modifications through test cases, and
isolates test. So far, so good.
* Jenkins will do one run for tests with @group Database, and a separate run for
tests *without* @group Database - the latter test is actually run without any
database connection. Any test using the database in any way, and be it only
indirectly and for reading, will fail if it doesn't declare @group Database. Or
so it seems.
There are a number of test cases (and there could and should be many many more)
that use the database for reading only. It would be good to have a @group
DatabaseRead, that does not enforce the slow and expensive creation of temporary
tables, but allows the tests to be run with a database connection in place. This
run could use a connection with a database user that has read-only rights to the
database.
If we decide to do this, there should be some way to define and re-create the
initial contents of the read-only database. Perhaps a maintenance script that
other parts of the code (and extensions) can register with could do the trick.
What do you think? Is this feasible?
-- daniel