-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.5+] Mockery assertions not counted and tests marked as risky #25703
Comments
Please post an example test. |
@staudenmeir I have added it to the op |
This test runs successfully on my machine. What's your exact PHPUnit version? |
PHPUnit: 6.5.13 phpunit.xml
|
I'm using the same versions. Can you reproduce the issue on a fresh Laravel installation? |
@staudenmeir I'll try that tomorrow, seemed pretty cut and dry to replicate, thanks for the help so far... |
I've seen this before - and the problem I had was I was overriding either the Given we cant replicate on a fresh install of Laravel, I'm going to close this issue. If @dmason30 you can provide steps to replicate on a fresh install - ping me here with the steps and I'll reopen the ticket. |
@laurencei I will look at this soon, however just as an FYI, http://docs.mockery.io/en/latest/getting_started/upgrading.html#upgrading-to-1-0-0
However the http://docs.mockery.io/en/latest/reference/phpunit_integration.html#phpunit-integration
|
@laurencei Turns out it was laravel/browser-kit-testing was still on v2 which meant that the above code was missing. 😳 My bad. Sorry. |
Description:
In #20606 there was an attempt to fix this issue by adding the below code in the
tearDown
method:The issue here is in
PHPUnit 6.*
the Mark test as risky check was moved to before thetearDown
function. So the change made in #20606 no longer seems to have the desired effect.A similar issue was discussed in sebastianbergmann/phpunit#2758 and it appears that the above code should be handled in
assertPostConditions
.Mockery
does provide aMockery\Adapter\Phpunit\MockeryPHPUnitIntegration
trait that handles this.I am not sure if this would be compatible with the
TestCase
provided in laravel. I have managed to put it in my ownTestCase
extending Laravel's class and it seems to work correctly.Steps to replicate
Create a test that only contains a
Mockery
assertion/expectation and PHPUnit 6 thinks its risky.Below is a very crude example that replicates the issue. It is not really testing anything but it is the simplest example I came up with.
Foo.php
FooTest.php
The text was updated successfully, but these errors were encountered: