The correct way is PHPunit test mock getRequest-> getHeader ('referer')

I am writing unit tests that require me to either use mock getRequest->getHeader('referer')in the framework of Zend, where there is a condition for referencing, to determine if a new session is established based on its value.

What would be the best way to verify this correctly?

Should I just make fun of the controller and call the header request, for example $controller->getRequest->getHeader('referer'), or do I need to make fun of the request object?

Obviously, since this is a unit test, they simply mocked this behavior to make sure the code worked correctly, so I'm not even sure how you could simulate a url request header.

+3
source share
1 answer

. Zend_Controller_Request_HttpTestCase, (, , , uri, cookie ..). , .

+1

All Articles