-
Bug
-
Resolution: Deferred
-
Minor
-
None
-
4.1.3
Got the following unit test failure recently:
Moodle 4.1.3+ (Build: 20230427) |
Php: 7.4.33, mariadb: 10.5.20, OS: Linux 5.15.0-1023-aws x86_64 |
PHPUnit 9.5.27 by Sebastian Bergmann and contributors. |
|
...
|
|
There were N failures:
|
|
1) core\oauth2_test::test_get_empty_internalfield_list |
Failed asserting that two arrays are equal.
|
--- Expected
|
+++ Actual
|
@@ @@
|
16 => 'alternatename' |
17 => 'picture' |
18 => 'username' |
+ 19 => 'profile_field_provider' |
+ 20 => 'profile_field_birthdate' |
)
|
|
/var/www/site/lib/tests/oauth2_test.php:557 |
/var/www/site/lib/phpunit/classes/advanced_testcase.php:80 |
phpvfscomposer:///var/www/site/vendor/phpunit/phpunit/phpunit:97 |
The profile_field_provider and profile_field_birthdate fields are fields added by a 3rd party plugin on install.
They way the test asserts user fields doesn't allow plugins to add their custom fields, see https://github.com/moodle/moodle/blob/017a3274fe8f24ab2473eb6e5626070f97d2721d/lib/tests/oauth2_test.php#L547-L558
Seems to be a regression of MDL-77436.
Steps to replicate:
- Add a plugin that has any profile fields, eg:
git clone git@github.com:golenkovm/moodle-local_mdl_helper.git local/mdl_helper
- Run the unit test and confirm it fails:
root@01c31895db1b:/var/www/vanilla-moodle-master# vendor/bin/phpunit --filter='test_get_empty_internalfield_list'
Moodle 4.3dev (Build: 20230512), 063ffc8073c679537b3a23ec8f3fc3dec03dba69
Php: 8.0.26, pgsql: 14.0 (Debian 14.0-1.pgdg110+1), OS: Linux 5.15.0-69-generic x86_64
PHPUnit 9.5.27 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 00:00.700, Memory: 320.00 MB
There was 1 failure:
1) core\oauth2_test::test_get_empty_internalfield_list
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
16 => 'alternatename'
17 => 'picture'
18 => 'username'
+ 19 => 'profile_field_myprofilefield1'
+ 20 => 'profile_field_myprofilefield2'
)
/var/www/vanilla-moodle-master/lib/tests/oauth2_test.php:557
/var/www/vanilla-moodle-master/lib/phpunit/classes/advanced_testcase.php:94
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Edit: the following tests are failing:
test_create_custom_profile_field_category
test_create_custom_profile_field
test_get_empty_internalfield_list (this is the one you mentioned)