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:
Rajesh Taneja
2016-08-23 15:19:29 +08:00
parent 47f8aa9400
commit f7a8bc6378
2 changed files with 13 additions and 1 deletions
+12 -1
View File
@@ -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';
}
/**