-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
BUG: PHPUnit test is failing in Moodle 3.11 and 4.0 #32
Comments
Humm, I just run the tests in both 3.11 (version 2021051707.04) and 4.0 (version 2022041901.04) with the following invocation:
And as you can see, it seems to be using PHPUnit 9.5, and executing the tests successfully in both cases. So I am unable to reproduce the issue locally. And I don't know what else to do to try to reproduce it. Does your output show the same tools versions as mine (PHP version aside, as depending on your environment it may be different). Althoug that may be it, are you using a more recent PHP version? Like 8.x? |
Hi @iarenaza I am using PHPUnit 9.5 with PHP 7.4.25 and the latest release of moodle-local_codechecker. I tried the command line you used and got similar results to yours. I think it is a difference in the command line that I use:
The result is:
The problem is that the PHPUnit requirements for class and file naming changed starting with Moodle 3.11 and up. For more information, see https://docs.moodle.org/dev/PHPUnit_integration#Class_and_file_naming_rules On a side note, in order to avoid a code precheck phpcs warnings on Moodle.org, I recommend you also look into @Covers. See: Hope you find this information helpful. Best regards, Michael Milette |
Hi @iarenaza FYI: Without the correction, you will get the following warning messages in the section PHP coding style problems in the precheck next time you upload try to load the plugin to Moodle.org. Note: This is just a simulation of the warning messages (I substituted filtercodes for multilang2 in the messages):
I had similar issues with my FilterCodes plugin whose test file was configured similar to yours. If you are interested, visit https://github.com/michael-milette/moodle-filter_filtercodes/blob/master/tests/filter_test.php to see how I resolved it. The version of FilterCodes on Moodle.org still generated one warning but that is because it does not include the @Covers which is included in the version on GitHub. I am a big fan of your plugin and just want to help you out. Thank you for all your efforts. Michael |
Thanks a lot @lucaboesch and @michael-milette for your help fixing this issue! |
When I run the unit test on multilang2, I get the following error:
I suspect this is due to changes in PHPUnit 9.5.
Any chance you could fix this please?
Best regards,
Michael
The text was updated successfully, but these errors were encountered: