Abstract database specific tests and fixtures #19647
Labels
Enhancement
For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone
Our test suite contains tests and fixtures which execute MySQL specific DDL statements. In order to support alternative databases we need to abstract these statements to the
core/Db
class or PDO adapter. Ideally tests and fixtures should never execute DDL statements directly.Suggested Approach
Identify MySQL specific tests that only make sense to run on MySQL, adjust these tests to check which PDO adapter is in use and
markTestSkipped
if not running the MySQL PDO adapter.Non-db specific tests and fixtures that directly create tables or databases need to be abstracted to methods in
core/Db
which could then abstract to the PDO adapter as needed.Integration tests depend on the OmniFixture database dump which is MySQL specific:
Rename the OmniFixture dump based on the database adapter name is it suited for, ie.
OmniFixture-dump-mysql.sql
.A new
getOmniFixtureFilename()
method should be added tocore/Db/AdapterInterface
this will return the OmniFixture filename to use so PDO Adapters can share the same dump if required. The standard Matomo MySQL PDO adapter should returnOmniFixture-dump-mysql.sql
.Integration testing code should use the chosen PDO Adapter
getOmniFixtureFilename()
method to determine the OmniFixture data to load. Future PDO adapters can then override this method load data suitable for their schema.Clean up the instructions and commands around generating new OmniFixture dumps.
The text was updated successfully, but these errors were encountered: