Automatic verification of mocks does not work in 2.2 #3005

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

Comments

Projects
None yet
2 participants
@Naktibalda
Member

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

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Apr 19, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Apr 19, 2016

Member

It probably needs $I->registerMock()

Member

Naktibalda commented Apr 19, 2016

It probably needs $I->registerMock()

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Apr 19, 2016

Member

Good idea. Instead of using Stub...

Member

DavertMik commented Apr 19, 2016

Good idea. Instead of using Stub...

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Apr 19, 2016

Member

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

Member

Naktibalda commented Apr 19, 2016

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

@DavertMik DavertMik added the 2.2 label Apr 19, 2016

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Apr 19, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Apr 20, 2016

Member

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

Member

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