Affects Version/s: 2.3.4, 2.4.1, 2.5
Component/s: Unit tests
1/ run mysql DML tests
2/ hack test_onelevel_rollback() as described in description
3/ run mysql DML tests again - only one more failure expectedShow1/ run mysql DML tests 2/ hack test_onelevel_rollback() as described in description 3/ run mysql DML tests again - only one more failure expected
Affected Branches:MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
Fixed Branches:MOODLE_23_STABLE, MOODLE_24_STABLE
Pull from Repository:
Pull Master Branch:w13_
Pull Master Diff URL:
After detecting a lot of "new" surprise/errors in the MSSQL driver, it was detected that any (real) failure in the test_onelevel_rollback() test case was affecting to all the rest of transaction test cases in lib/dml/tests/dml_test.php
The ultimate cause is that the 1st test case leaves open one transaction, so all the next test cases fail badly.
To reproduce it (under any database):
1) Edit lib/dml/tests/dml_test.php
2) Go to test_onelevel_rollback() and addd this line:
Before any of the allow_commit() calls in the method.
(that will cause the testcase to stop, so the allow_coomit (close transactions is never executed).
3) run "phpunit dml_testcase lib/dml/tests/dml_test.php"
4) You will get various failures in other test cases because 2 left the transaction open.
While this can be easily prevented in tearDown() or friends... surely the safest way is to close any transaction as part of the standard "reset" thing, to guarantee real test case independence.