-
Bug
-
Resolution: Fixed
-
Minor
-
4.5
withConsecutive() was deprecated in PHPUnit 9.6 (without visible warning) and completely removed in PHPUnit 10. There is no direct replacement, but here are some ideas on how to solve this: https://github.com/sebastianbergmann/phpunit/issues/4026
We have a few instances of those...
$ ag '>withConsecutive' --php
|
admin/tool/dataprivacy/tests/expired_contexts_test.php
|
1375: ->withConsecutive(
|
1593: ->withConsecutive(
|
1646: ->withConsecutive(
|
1865: ->withConsecutive(
|
|
admin/tool/usertours/tests/tour_test.php
|
567: ->withConsecutive(
|
|
course/tests/category_hooks_test.php
|
191: ->withConsecutive(
|
|
lib/tests/content/export/exportable_items/exportable_filearea_test.php
|
245: ->withConsecutive(...$storedfileargs);
|
|
lib/tests/content/export/exportable_items/exportable_textarea_test.php
|
331: ->withConsecutive(...$storedfileargs);
|
|
lib/tests/completionlib_test.php
|
268: ->withConsecutive(
|
690: ->withConsecutive(
|
1178: ->withConsecutive(
|
|
repository/dropbox/tests/api_test.php
|
423: ->withConsecutive(['testEndpoint'], ['testEndpoint/continue'], ['testEndpoint/continue'])
|
478: ->withConsecutive(
|
557: ->withConsecutive(
|
596: ->withConsecutive(
|
|
repository/googledocs/tests/googledocs_search_content_test.php
|
69: ->withConsecutive(
|
|
repository/googledocs/tests/local/browser/googledocs_drive_content_test.php
|
68: ->withConsecutive(
|
|
completion/tests/activity_custom_completion_test.php
|
106: ->withConsecutive(
|
In this issue we should:
- Decide the target for the fix: Moodle 4.4 with PHPUnit 9.6 vs future Moodle version with PHPUnit 10.
- Look how many of the uses detected are really useful, there is a lot of debate about when this sort of mocking is correct or no. Maybe we can reduce the uses.
- No matter the previous point, for sure some of the cases will need to be converted to some alternative, that can be:
- Create some trait providing an in-place (or near in-place) replacement.
- Add support from advanced_testcase or similar.
- Other, custom, working replacements, case by case.
- ...