Skip to content

Commit

Permalink
another force test
Browse files Browse the repository at this point in the history
  • Loading branch information
Glutamat42 committed May 13, 2024
1 parent d743aae commit c274d3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function adleradaptivity_delete_instance(int $instance_id): bool {
// - postgresql databases are not rolled back
// - course deletion succeeds without indication of an error
// - only module deletion behaves as expected and shows an error
$DB->force_transaction_rollback();
$transaction->rollback($e);
}

Expand Down
6 changes: 1 addition & 5 deletions tests/lib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,8 @@ public function test_delete_instance_failure_due_to_question_deletion_failure()
try {
// Try to delete the complex instance.
adleradaptivity_delete_instance($complex_adleradaptivity_module['module']->id);
} catch (Exception $e) {
// Roll back the transaction before re-throwing the exception
$DB->force_transaction_rollback();
throw $e;
} finally {
// sleep(60);
sleep(60);
// Ensure that no instances were deleted.
$this->assertCount(1, $DB->get_records('adleradaptivity'));
$this->assertCount(2, $DB->get_records('adleradaptivity_tasks'));
Expand Down

0 comments on commit c274d3d

Please sign in to comment.