Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing unit test #12

Closed
owenherbert opened this issue Nov 13, 2023 · 5 comments
Closed

Failing unit test #12

owenherbert opened this issue Nov 13, 2023 · 5 comments

Comments

@owenherbert
Copy link

My unit tests seem to be failing, I ran the command:

vendor/bin/phpunit report/advancedgrading/tests/locallib_test.php

Output:

Moodle 4.1.6+ (Build: 20231102), 141337c28fa0721de8f52460c111224ffc699c74
Php: 7.4.33, mysqli: 8.0.34, OS: Linux 6.2.0-36-generic x86_64
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

..F                                                                 3 / 3 (100%)

Time: 02:11.747, Memory: 107.00 MB

There was 1 failure:

1) report_advancedgrading\locallib_test::test_guide
Failed asserting that an array contains 'admin_452525f043d9bb60aa3da1ebf45ca6b5'.

@marcusgreen
Copy link
Owner

It looks to me like it refers to
$this->assertContains($gradeduser, $enrollednames);
https://github.com/marcusgreen/moodle-report_advancedgrading/blob/903ee3807d00fe7bca8b5aa9451bc2dbecf429d4/tests/locallib_test.php#L235C1-L235C60
You might find out more by adding a var_dump($gradeduser); and var_dump($enrollednames)
I suspect from memory I was expecting the array to contain just 'admin' and the magic of phpunit adds a bunch of stuff on to ensure it will cope with all manner of names. But that is only a guess.

@marcusgreen
Copy link
Owner

For a bit of background the unit tests and a whole bunch of other stuff runs whenever I make a commit and 3 weeks ago the unit tests ran without error. Could you provide more information on your setup, e.g. PHP version Moodle version etc. When it ran three weeks ago it was PHP 8.1 against Moodle version 4.3.

@owenherbert
Copy link
Author

Hi Marcus, thanks for the quick response. I am using PHP 7.4 and Moodle 4.1 on my system.

@owenherbert
Copy link
Author

owenherbert commented Nov 22, 2023

Looking deeper into this issue the unit tests pass when using PostgreSQL. My system is using MySQL database.

@marcusgreen
Copy link
Owner

I am closing this as the tests run against MySQL and MySQL in the ci (which runs each time I push any code). Feel free to re-open if it is still troubling you. Thanks for the feedback.
Marcus

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

No branches or pull requests

2 participants