Closed (won't fix)
Project:
Drupal core
Version:
11.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Apr 2020 at 16:53 UTC
Updated:
18 Jan 2026 at 02:06 UTC
Jump to comment: Most recent
There are two mocking frameworks used in Drupal core. Both are shipped by PHPUnit. Prophecy is the modern one.
Personally, I prefer mocking with Prophecy. So I would suggest promoting Prophecy and stick with it in Drupal core.
In general:
Needs discussion:
Comments
Comment #2
mondrakeJust a note that while working on PHPUnit 9 support in #3127141: Use PHPUnit 9 for PHP 7.4+, while keeping support for PHPUnit 8.4 in PHP 7.3, we are coming across a deprecation
Do not know yet, but maybe that needs to be taken into account here.
Comment #3
jungle@mondrake, thanks for your note!
phpspec/prophecy-phpunit as the replacement/workaround should be workable at that time when PHPUnit 10 is out. See the issue filed by the author of PHPUnit Make sure phpspec/prophecy-phpunit continues to work with PHPUnit 10 #4149
One more note:
Comment #9
andypostphpunit no longer depends on prophecy because it has weak support, see #3314632: upgrade phpspec/prophecy to 1.16.0 to support PHP 8.2
Comment #10
andypostSee also https://github.com/sebastianbergmann/phpunit/issues/4141
Comment #12
andypostLooking back at PHP 8.3 compatibility and facing incompatibilities with PHP 8.4 (initial adoption) I'd better close it as wont fix
each time prophecy mocks are late for new PHP version compatibility https://github.com/phpspec/prophecy/issues/624
Comment #13
andypostprophecy again is very slow on new PHP version compatibility
Comment #14
quietone commentedAs @andypost points out in #12, PHPUnit has deprecated the use of prophecy. He also points out that Prophecy has been slow up updating to newer versions of PHP. Therefore, let's stay with PHPUnit mocks and not make conversions to prophecy.