-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.8, 4.1.3, 4.2
The unit tests in \tool_uploaduser\cli_test fail if a plugin has created a custom checkbox profile field with default 0. (This is slightly similar to MDL-77611 but a completely different issue.)
This appears to be caused by \profile_field_base::edit_field_set_default() which incorrectly checks if default data is available by using empty(), which misses defaults of 0 and the empty string.
To reproduce, unzip the attached file local_fortest.zip into the local directory of Moodle, initialise phpunit and run tool_uploaduser_testsuite. (I hope timhunt doesn't mind me nicking his code from MDL-77611 )
The tests will fail with errors like this:
moodle_exception : error/CLI script finished with error code 1
$a contents:
/var/www/html/admin/tool/uploaduser/classes/cli_helper.php:199
/var/www/html/admin/tool/uploaduser/classes/cli_helper.php:186
/var/www/html/admin/tool/uploaduser/classes/cli_helper.php:386
/var/www/html/admin/tool/uploaduser/classes/cli_helper.php:266
/var/www/html/admin/tool/uploaduser/tests/cli_test.php:65
/var/www/html/lib/phpunit/classes/advanced_testcase.php:80
- has been marked as being related by
-
MDL-77611 tool_uploaduser\cli_test.php fails if other installed plugins create custom profile fields on install
-
- Closed
-
-
MDL-78303 Core unit tests fail when plugins define their custom fields in install
-
- Closed
-
-
MDL-78417 uploaduser.php fails when custom profile field that is not required exists
-
- Closed
-