I am trying to write a unit test (phpunit) to cover a controller action. I am receiving problems regarding invalid scope for the getRequest() call.
note: I am a newbie to Symfony2 and TDD (phpunit)
I guess this is because there is no request as such?
My questions are:
- Can I mock a request object?
- Am I approaching this in the right way? Should I be placing the bulk of the code into a service and then unit testing the service and only FUNCTIONAL test the controllers?
I think knowing the principle going forward is what I'm after, rather than the lines of code.