-
Sub-task
-
Resolution: Fixed
-
Minor
-
2.3.4, 2.4.1, 2.5
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
w13_
MDL-37782_m25_testtrans -
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:
$this->assertTrue(false);
|
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.
Ciao