I have a problem testing traits. One of my classes uses a trait and implements an interface. Interface methods by the way are being implemented by a trait.
When I run phpunit
with coverage report enabled I see that my class is shown as 100% covered, interface is shown as 100% covered, by trait is shown as 0%:
The class uses trait, methods from trait are being called in test suite, but still trait is considered uncovered.
Should traits be tested separately somehow? I know about getMockForTrait()
method, but I would like to avoid it. Is there any way to fix the issue and to cover trait by testing the class itself?