-
Bug
-
Resolution: Fixed
-
Minor
-
2.6.1
-
MySQL
-
MOODLE_26_STABLE
-
MOODLE_25_STABLE, MOODLE_26_STABLE
-
w12_
MDL-44191_m27_mysql56 -
When running a behat acceptance test it resets the database before each scenario at which point it is supposed to reset table sequences as needed. For empty tables it should reset the sequence to 1. This is important where element names are contain record ids for uniqueness and then features can work only if the record id remains the same for each run and that requires that the sequence will be reset.
With mysql, testing_util::reset_all_database_sequences calls for empty tables:
$DB->change_database_structure("ALTER TABLE {$prefix}{$table} AUTO_INCREMENT = 1");
But this query does not affect the sequence, not even when submitted directly via phpmyadmin.
A query that does work is "TRUNCATE TABLE {$prefix}{$table}".
Moodle behat api should probably provide a method to cleanup certain components/areas in the feature background, as failed tests may leave records in that database that will prevent sequence reset.