New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shouldBeCalled being true even when not called #251
Comments
In which way you're using Prophecy:
? If it's the 2nd case, then I'm suspecting that |
Im using 1. From my composer.lock: "name": "phpunit/phpunit", "name": "phpspec/prophecy", |
Here the same exact problem. Using Prophecy integrated in PHPUnit. If I manually go for a checkPredictions call in the teardown (overriding the $prophet var that is private) everything works as should be. Notice that only the assertions on the method calls aren't working. This is my composer.json content
|
Ok now I went a little bit more in a deep and I found the reason for this "strange" behaviour.
the exception for the failure is correctly thrown, but the catch does simply nothing with the exception, so it is failing silently. The real strange thing are those comments. Why aren't you re-throwing the exception? Do you "intentionally" wanted a red test to stay green? :D |
It's PHPUnit problem obviously. I recommend posting in there as well. Looking through PHPUnit commit history (at point where this code was created) might explain (in commit message) why this was done like this. |
@kekko1212 would you mind to check what type of an exception is thrown and ignored exactly? Including the message? |
Looking at code below mentioned one shows And yes, the problem is that |
Yes, it's a phpunit issue (only related to phpspec). The fix in PHPUnit 5.x solves this issue. Thanks |
Ive made a gist to illustrate my problem: https://gist.github.com/pedrofornaza/b819977e5415a0fc1643
The 'releaseEvents' should be called, but its not. The tests works even if i comment all the try body. The test fails if i use a spy (shouldHaveBeenCalled).
I did something wrong is that a bug?
Thanks in advance. :)
The text was updated successfully, but these errors were encountered: