-
Notifications
You must be signed in to change notification settings - Fork 4
Add tests for ResultRendererFactory class #126
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
Conversation
Current coverage is 88.80% (diff: 100%)@@ master #126 diff @@
==========================================
Files 69 69
Lines 1594 1546 -48
Methods 281 282 +1
Messages 0 0
Branches 0 0
==========================================
- Hits 1404 1373 -31
+ Misses 190 173 -17
Partials 0 0
|
|
||
protected function isImplementationNameOfClass($implementationName, $className) | ||
{ | ||
return is_string($implementationName) && is_subclass_of($implementationName, $className); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @TheoKouzelis what is the advantage of is_subclass_of
instead of class_implements
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think class_implements
returns an array of interfaces that the given class implements. http://php.net/manual/en/function.class-implements.php
So I think the previous code started to fail because the following statement would be true if the class implemented any interface and not specifically ResultInterface::class
!class_implements($resultClass, ResultInterface::class)
I think the code could have also been refactored to the following but I thought is_subclass_of
seemed more direct
!in_array(ResultInterface::class, class_implements($resultClass))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow - so it never worked 😂 - nice find!
Thanks @TheoKouzelis ! |
Thanks |
No description provided.