MDL-46514 behat: Delete tablesupdatedbyscenario before suite
Delete tablesupdatedbyscenario before db reset to ensure db is fully reset. In case user exits or process terminated then the file will be left and can lead to wrong results
This commit is contained in:
@@ -939,12 +939,23 @@ abstract class testing_util {
|
||||
self::$tableupdated = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete tablesupdatedbyscenario file. This should be called before suite,
|
||||
* to ensure full db reset.
|
||||
*/
|
||||
public static function clean_tables_updated_by_scenario_list() {
|
||||
$tablesupdatedfile = self::get_tables_updated_by_scenario_list_path();
|
||||
if (file_exists($tablesupdatedfile)) {
|
||||
unlink($tablesupdatedfile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the file which holds list of tables updated in scenario.
|
||||
* @return string
|
||||
*/
|
||||
protected final static function get_tables_updated_by_scenario_list_path() {
|
||||
return self::get_dataroot() . '/tablesupdatedbyscenario.txt';
|
||||
return self::get_dataroot() . '/tablesupdatedbyscenario.json';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,6 +153,7 @@ class behat_hooks extends behat_base {
|
||||
|
||||
// Reset all data, before checking for check_server_status.
|
||||
// If not done, then it can return apache error, while running tests.
|
||||
behat_util::clean_tables_updated_by_scenario_list();
|
||||
behat_util::reset_all_data();
|
||||
|
||||
// Check if server is running and using same version for cli and apache.
|
||||
|
||||
Reference in New Issue
Block a user