MDL-71367 unit tests: Add missing ->destroy() call to test backups
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 18 Apr 2021 21:43:13 +0000 (23:43 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 18 Apr 2021 22:04:10 +0000 (00:04 +0200)
As part of the tests preparations, some backups are created, but
the tests aren't calling to their ->destroy() method at the end.

The destroy() method is needed to go cleaning and unsetting various
objects that, only then, will free resources, like memory, open files...

This isn't critical under Unix OSs... but Windows is really sensible
and keeps all open files locked, so any write operation on them fails.

backup/tests/backup_cleanup_task_test.php

index e4b71c8..98fdbb3 100644 (file)
@@ -60,6 +60,7 @@ class core_backup_cleanup_task_testcase extends advanced_testcase {
             $user->id
         );
         $controller->execute_plan();
+        $controller->destroy(); // Unset all structures, close files...
         return $controller->get_backupid();
     }