Problem/Motivation
The following code snippet does not fail a test on PHP 7:
$mock = $this->prophesize(\Drupal\Core\Mail\MailManagerInterface::class);
$mock->mail(\Prophecy\Argument::any())->shouldNotBeCalled();
$mail = $mail->reveal();
$mail->mail('system', 'action_send_email', 'admin@example.com', 'en');
We identified the bug in PHPUnit_Framework_TestCase::verifyMockObjects(), but it is fixed on the latest phpunit 4 version.
Proposed resolution
Upgrade phpunit to the latest phpunit 4 version to have reliable mocking expectations on PHP 7.
composer update phpunit/phpunit should do it.
Remaining tasks
Patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
klausiPatch.
I think we should not test this in Drupal because it is clearly an upstream bug and already covered by their tests. No need to duplicate that.
Comment #3
klausiComment #4
alexpottI discovered this bug and was super confused. I think this is a critical bug because tests not actually testing what you think is being tested is super dangerous.
Also we have a policy to try to ensure that our dependencies are updated before minor release so I think this is rc eligible too.
Comment #5
alexpottThe precise commit the fixed this in PHPUnit was https://github.com/sebastianbergmann/phpunit/commit/0774df619ddab4c605cb...
Comment #6
alexpottComment #9
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!
Comment #10
wim leers+1
I have no idea how you even tracked this down! klausi++
Comment #11
klausiall credit to alexpott, I only contributed confused facial expressions.
Comment #12
wim leers:D :D :D :D
BEST CONTRIBUTION TYPE EVER