You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've migrated to this trait since PHPUnit deprecated its integration with Prophecy.
I've struggled a little since then, but I've now found the root of my issue: mocks are not failing immediately as before.
This is a reproducer:
<?phpdeclare(strict_types=1);
classMockRegressionTestextends \PHPUnit\Framework\TestCase
{
useProphecyTrait;
publicfunctiontest(): void
{
$prophecy = $this->prophesize(\PHPUnit\Framework\TestSuite::class);
$prophecy->addTestFile('foo.php')
->shouldBeCalledOnce();
$prophecy->reveal()
->addTestFile('bar.php'); // should fail here$this->fail('If we got here, we have some trouble'); // goes on and fails here
}
}
Test should fail immediately when calling the method with the wrong argument, but it doesn't. This leads to the mock returning null and either failing with a TypeError or going further, making the test failure a lot harder to debug.
Copying this reproducer into a PHPSpec test gets the right behavior.
Thanks to @DonCallisto for the help debugging this issue.
The text was updated successfully, but these errors were encountered:
Jean85
added a commit
to Jean85/prophecy-phpunit
that referenced
this issue
Oct 7, 2020
I've migrated to this trait since PHPUnit deprecated its integration with Prophecy.
I've struggled a little since then, but I've now found the root of my issue: mocks are not failing immediately as before.
This is a reproducer:
Test should fail immediately when calling the method with the wrong argument, but it doesn't. This leads to the mock returning
null
and either failing with aTypeError
or going further, making the test failure a lot harder to debug.Copying this reproducer into a PHPSpec test gets the right behavior.
Thanks to @DonCallisto for the help debugging this issue.
The text was updated successfully, but these errors were encountered: