Add tests for ResultRendererFactory class#126
Add tests for ResultRendererFactory class#126AydinHassan merged 2 commits intophp-school:masterfrom TheoKouzelis:master
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.
hey @TheoKouzelis what is the advantage of is_subclass_of instead of class_implements ?
There was a problem hiding this comment.
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_ofseemed more direct
!in_array(ResultInterface::class, class_implements($resultClass))
There was a problem hiding this comment.
oh wow - so it never worked 😂 - nice find!
|
Thanks @TheoKouzelis ! |
|
Thanks |
No description provided.