xAPI-vle / moodle-logstore_xapi

A Moodle plugin to send xAPI statements to an LRS using events in the Moodle logstore.
GNU General Public License v3.0
74 stars 85 forks source link

Historical and Failed Report unit tests fail when using PostgreSQL #824

Closed davidpesce closed 1 year ago

davidpesce commented 1 year ago

Description

Per Moodle Developer chat:

"Eloy Lafuente: It’s required for postgres because only postgres tries to rollback using transactions. MySQL doesn’t support that (because DDL cannot be rollback). PostgreSQL and SQL*Server, in fact (support rollbacking DDL). And our tests try to use that way unless specifically prevented.

In general… tests that cover stuff that uses transactions… cannot be rollbacked with transactions. For those ones is when we have to set the prevent thing. and then the slower (but safer) reset is done (check all tables, check all contents… one by one (basically explained)"

davidpesce commented 1 year ago

Mostly adding this for historical context. The fix was here: https://docs.moodle.org/dev/Writing_PHPUnit_tests#Logstores

And specifically that this $this->preventResetByRollback(); was needed.