I am being pedantic but…
I am implementing unit test for a framework and the one component I cannot figure out how to test is the Request object, primarily because it is a simple wrapper around the $_REQUEST super global. I need to either fake HTTP request to properly populate this variable (at least PHP 5.3.4) or I need to remove the dependency and initialize the request object using $_REQUEST or whatever I wish.
While this seems the logical solution (I am always in favour of DI/IoC) I dislike the solution in this case, for reasons I do not wish to get into right now, or I fear this discussion taking on a whole different purpose.
What I want to know, is there a work around in PHPUnit (perhaps using the now built-in HTTP server of PHP 5.4.0 binary?) to allow me to test my framework at the Request object level without changing the interface/implementation of my request object (ie: injecting $_REQUEST)?
Currently the Request simply acts as a simple wrapper around the $_REQUEST super global - and it does not seem possible to populate super globals manually within the test itself.
Remember - I am not looking to change the code at all in my Request object so using globals, etc is not the solution I seek. Rather a PHPUnit extension or technique that allows me to invoke the tests in an HTTP context as opposed to CLI.
Regards,
Alex