Skip to content

Commit

Permalink
remove old workaround (trying to use debugging for logging) and fixed…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
Glutamat42 committed Apr 3, 2024
1 parent 78a676e commit 4137e0c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions tests/lib/adler_testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 4137e0c

Please sign in to comment.