Skip to content

Conversation

niko-hoogeveen
Copy link

Closes Issue #32.

I've added the proper return types for functions in logging/loggerbase.php to fix the fatal errors occurring in PHPUnit tests.

Environment Details

  • PHP 8.1
  • MOODLE 4.5
  • Postgres 16.0

Branch that has the issue:

  • MOODLE_405_STABLE

How to recreate the issue?

  1. Deploy a local Moodle 4.5 instance (with this plugin installed on branch MOODLE_405_STABLE)
  2. Initialize PHPUnit testing environment
  3. Run vendor/bin/phpunit -> the error only appears when running the full list of unit tests. Running vendor/bin/phpunit --testsuite mod_collaborate_testsuite yields no errors.

Actual Output

Moodle 4.5.5 (Build: 20250609)
Php: 8.1.2.1.2.22, pgsql: 16.9 (Debian 16.9-1.pgdg120+1), OS: Linux 6.8.0-1021-aws x86_64
PHPUnit 9.6.18 by Sebastian Bergmann and contributors.

...........................................................    59 / 31274 (  0%)
...........................................................   118 / 31274 (  0%)
..........................................SS...............   177 / 31274 (  0%)
...........................................................   236 / 31274 (  0%)
...........................................................   295 / 31274 (  0%)
<shortened test output>
........................................................... 12036 / 31274 ( 38%)
......................................................
Fatal error: Declaration of mod_collaborate\logging\loggerdb::log($level, $message, array $context = []) must be compatible with mod_collaborate\logging\loggerbase::log($level, $message, array $context = []): void in /var/www/site/mod/collaborate/classes/logging/loggerdb.php on line 41
PHP Fatal error:  Declaration of mod_collaborate\logging\loggerdb::log($level, $message, array $context = []) must be compatible with mod_collaborate\logging\loggerbase::log($level, $message, array $context = []): void in /var/www/site/mod/collaborate/classes/logging/loggerdb.php on line 41

Checkout to my branch, and you should see no PHP Fatal errors related to mod_collaborate when running vendor/bin/phpunit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant