Codeception/AspectMock

AspectMock does fail PHPUnit with no assertions done

icanhazstring opened this issue · 4 comments

Currently verifyInvoked does not count towards the assertion count of PHPUnit.
This is probably due to the "non integration" of AspectMock into PHPUnit.

I can think of two possible solutions for this (if this is an issue at all)

  1. Provide a phpunit-extension combined with AspectMock. This extension could provide a specific TestCase class which already does the integration for you (cleaning test mocks and stuff) and giving you the ability to create doubles as well as new asserts

  2. Given a trait could work as well. Providing the needed data to create double and check for method invokations, while counting towards the assertion count for PHPUnit while keeping the default extends TestCase structure for existing tests

@icanhazstring
I have "fixed" this for me locally using
PHPUnit\Framework\Assert::assertTrue(true);
in all valid return pathes on invocation verification.
In my oppinion it does not matter, because it is just to satisfy PHPUnit and has no further meaning.
Exceptions are handled still the way before by using fail.

@bhoehl yea this could be an option. But it would be nice to actually get the count of the assertions I do with AspectMock.

Maybe i'll find some time to actually provide an extension to invoke AspectMock :)

I merged pull request.

Released as 3.1.0