From 4137e0c2ace923e8c0f7ec28b492dff7bec5dfa6 Mon Sep 17 00:00:00 2001 From: Markus Heck Date: Wed, 3 Apr 2024 18:11:16 +0200 Subject: [PATCH] remove old workaround (trying to use debugging for logging) and fixed some code - proper Mockery integration into PHPUnit - fix upload_course.php parameters to align with moodle standards - fix tests sometimes configuring completionlib on course level wrong - in tests: dynamically declaring class level variables is deprecated in more recent php versions -> fixing --- tests/lib/adler_testcase.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tests/lib/adler_testcase.php b/tests/lib/adler_testcase.php index fcfaf67..6903db4 100644 --- a/tests/lib/adler_testcase.php +++ b/tests/lib/adler_testcase.php @@ -28,16 +28,7 @@ public function setUp(): void { public function tearDown(): void { parent::tearDown(); - // Moodle thinks debugging messages should be tested (check for debugging messages in unit tests). - // Imho this is very bad practice, because devs should be encouraged to provide additional Information - // for debugging. Checking for log messages in tests provides huge additional effort (e.g. tests will fail because - // a message was changed / an additional one was added / ...). Because logging should NEVER affect the - // functionality of the code, this is completely unnecessary. Where this leads can be perfectly seen in all - // moodle code: Things work or do not work and there is no feedback on that. Often things return null if successfully - // and if nothing happened (also categorized as successful), but no feedback is available which of both cases happened. - // Users and devs very often can't know why something does not work. - // If something went wrong either the code should handle the problem or it should throw an exception. - $this->resetDebugging(); + Mockery::close(); } }