>> Instead of getting a instance of Zend_Controller_Front, is it okay
>> to use
>> Zend_Http_Client (more straightforward for me) to perform a HTTP
>> request in
>> unit test?
> That works, but it is dependent on having the web server up and
> running.
> I typically like my tests to be able to run with or without using the
> web server -- I think of the tests as my sanity check prior to pushing
> live.
>
> Testing against the actual web server is good, too, but I find I often
> want to test as I'm developing, and not need to worry about setting
> up a
> vhost. Using the controller's request/response pair lets me do that.
As a response the the "is it okay" question: More and more of us
(myself included) have some kind of "must do more testing" resolution
but there is the perception, particularly for small teams and sole
developer situations, that unit testing adds an overhead, albeit in
the short term, to the work. If you do have the webserver setup then
using Zend_Http_Client is a very quick and simple way to run these
kind of tests and in that respect a fast forward to developing the
"test first" habit. Once that habit is established then you can look
at the different ways of testing.
In short I think if you're just getting into setting up your tests
then go with the simplest route that works. You can always refine
them later but initially it's more important to actually have the
tests in the first place.
Nick