Skip to content
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

Automatic verification of mocks does not work in 2.2 #3005

Closed
Naktibalda opened this issue Apr 19, 2016 · 6 comments
Closed

Automatic verification of mocks does not work in 2.2 #3005

Naktibalda opened this issue Apr 19, 2016 · 6 comments
Labels

Comments

@Naktibalda
Copy link
Member

@Naktibalda Naktibalda commented Apr 19, 2016

Mock expectation are verified automatically if the instance of PHPUnit_Framework_TestCase is passed as the last argument to Stub::makeX methods.

It works well in 2.1 because all test formats extend PHPUnit_Framework_TestCase,
in 2.2 Cept and Cest formats no longer extend it, so we have to come up with alternative strategy for mock verification.

@Naktibalda Naktibalda added this to the 2.2 milestone Apr 19, 2016
@DavertMik
Copy link
Member

@DavertMik DavertMik commented Apr 19, 2016

Fuck the mocks )
The most simple solution to me is to have in asserts module $I->verifyMocks()

@DavertMik DavertMik added the Discuss label Apr 19, 2016
@Naktibalda
Copy link
Member Author

@Naktibalda Naktibalda commented Apr 19, 2016

It probably needs $I->registerMock()

@DavertMik
Copy link
Member

@DavertMik DavertMik commented Apr 19, 2016

Good idea. Instead of using Stub...

@Naktibalda
Copy link
Member Author

@Naktibalda Naktibalda commented Apr 19, 2016

$I->registerMock(Stub::makeEmpty('class', []));

@DavertMik DavertMik added the 2.2 label Apr 19, 2016
@DavertMik
Copy link
Member

@DavertMik DavertMik commented Apr 19, 2016

I should think on it more. Not sure it even comes to 2.2.0 because it's pretty rare case using Stub:: with mocks inside Cest files. However, I'd integrate them into the scenario rather using of static Stub class

@DavertMik DavertMik removed this from the 2.2 milestone Apr 19, 2016
@Naktibalda
Copy link
Member Author

@Naktibalda Naktibalda commented Apr 20, 2016

If you could document this in Release Notes of 2.2, it would be enough to me.

DavertMik added a commit that referenced this issue Apr 20, 2016
@DavertMik DavertMik closed this Apr 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.