Closed sebastianbergmann closed 9 years ago
Why is this needed? This is not supposed to be changed, why can't you simply mock and inject them on constructor?
@bakura10 Thank you for your time to look at this. This is required because in the context of a test that uses Zend Framework 2's AbstractHttpControllerTestCase
the guards are already registered by the time we can inject mocks into the service locator. Using the setter injection added by this patch we can replace the original instance with out mock which we cannot register otherwise.
Okay, I definitely think that mocking of controller should be done easier in ZF2, but given the current limitation, change sounds sane. I'll merge and tag.
Done. ZfcRbac has been tagged to 2.5.2
Thanks!
@sebastianbergmann Is it possible to give an example of how to use this patch? I am struggling with this exact issue but I don't understand how these setters help.
@clemf Sorry, I don't remember the details.
This solves problems such as the one described at http://stackoverflow.com/questions/29340127/zend-framework-2-abstractcontrollertestcase-and-zfcuser-zfcrbac