From c67fe6e877ecfcdf90d8ac2a34fa6f0db1d510cc Mon Sep 17 00:00:00 2001 From: Nathan Nguyen Date: Mon, 28 Oct 2024 09:38:36 +1100 Subject: [PATCH] Fix unit test --- tests/process_error_test.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/process_error_test.php b/tests/process_error_test.php index 2e601fe1..38a29b49 100644 --- a/tests/process_error_test.php +++ b/tests/process_error_test.php @@ -110,11 +110,10 @@ public function test_process_error_in_table() { $record = reset($records); $this->assertEquals($this->course->id, $record->courseid); - if (version_compare(PHP_VERSION, '8.0', '<')) { - $this->assertStringContainsString("Trying to get property 'id' of non-object", $record->errormessage); - } else { - $this->assertStringContainsString("Attempt to read property \"id\" on bool", $record->errormessage); - } + // We may not know the exact error message. + // For example, if there are other plugins that implement the pre_course_delete hook, + // We will get different error messages, when those plugin trying to acess course modules. + $this->assertNotEmpty($record->errormessage); $this->assertEquals($process->id, $record->id); }