Changed test typehint from AbstractTest to TestInterface. #173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is very simple, it allows
Suite::runTest()
to run anyTestInterface
implementation, instead of requiring tests to extendAbstractTest
. It seems like the use ofAbstractTest
as a type hint was probably left over from a time beforeTestInterface
existed.What's more interesting, and what I can't figure out, is why this was only causing problems for me under PHP 7.
I have a pretty advanced use case. I am testing asynchronous code that uses Recoil, a generator-based coroutine library. I'm using Peridot's event system to wrap every test in my own implementation of
TestInterface
that runs the test under Recoil. My Peridot configuration looks like this:This allows Peridot tests to become Recoil coroutines, and to use
yield
inside tests to perform asynchronous operations:This is working perfectly under PHP 5.6, but under PHP 7 I get:
I have absolutely no idea how it could be working under 5.6 and not under 7, but there it is. Perhaps someone with a better understanding of Peridot could come up with a simpler, reproducible regression test for this issue.
In any case, this PR makes the problem go away.