mdjnelson / moodle-mod_customcert

Enables the creation of dynamically generated certificates with complete customisation via the web browser.
https://moodle.org/plugins/mod_customcert
GNU General Public License v3.0
94 stars 160 forks source link

The Custom Certificate module causes core unit test failure #609

Closed micaherne closed 8 months ago

micaherne commented 8 months ago

In Moodle 4.3, if you run unit tests in the normal way (without the --process-isolation flag, or equivalent config), the component_test::test_get_component_classes_in_namespace core test fails due to mod_customcert.

1) component_test::test_get_component_classes_in_namespace
coding_exception: Coding error detected, it must be fixed by a programmer: When including this file for a unit test, the test must be run in an isolated process. See the PHPUnit @runInSeparateProcess and @runTestsInSeparateProcesses annotations.

/var/www/html/lib/setuplib.php:2210
/var/www/html/lib/externallib.php:35
/var/www/html/mod/customcert/classes/output/mobile.php:29
/var/www/html/lib/classes/component.php:147
/var/www/html/lib/classes/component.php:964
/var/www/html/lib/tests/component_test.php:516
/var/www/html/lib/phpunit/classes/advanced_testcase.php:81

This is because classes/output/mobile.php requires lib/externallib.php which now enforces process isolation.

mdjnelson commented 8 months ago

Just for my reference this also happens in 4.2 as well by running vendor/bin/phpunit lib/tests/component_test.php. This is because of https://github.com/mdjnelson/moodle-mod_customcert/issues/565 as you mentioned.

mdjnelson commented 8 months ago

Just linking https://moodledev.io/docs/4.2/devupdate.

mdjnelson commented 8 months ago

Fixed, will push soon.