-- till <[email protected]> wrote (on Wednesday, 18 March 2009, 12:47 PM +0100): > On Tue, Mar 17, 2009 at 9:26 PM, Matthew Weier O'Phinney > <[email protected]> wrote: > > -- Giorgio Sironi <[email protected]> wrote > > (on Tuesday, 17 March 2009, 09:04 PM +0100): > >> 2009/3/17 Matthew Weier O'Phinney <[email protected]> > >> > >> -- till <[email protected]> wrote > >> > In general, is Zend_Test ready for "production" yet? I think I pretty > >> > much run into everything that's still being worked on -- e.g. > >> > Zend_Session (static issues), cookie-related, etc.. So far, I'm > >> > pondering to write "regular" unit tests which would involve getting > >> > the pages through a http client and then parsing them with DOM > >> > methods. > >> > >> It's production ready -- I've been using it a ton. The principal issues > >> lie in the framework itself. For instance, we need to add cookie > >> support > >> in the response object, and Zend_Session needs to be refactored to make > >> it easier to test against. > >> > >> > >> In my opinion Zend_File (used for uploading) is another component that > >> needs > >> refactoring because without patches it cannot be tested. > > > > This, like session management, is an area that's really hard to test, > > period, due to how PHP works. The only reasonable solution for use with > > Zend_Test_PHPUnit_ControllerTestCase I can come up with is to utilize a > > different file upload adapter -- which is problematic without a solution > > for dependency injection. > > I think the common mis-understanding is that people try to test the > server configuration, but the idea would be not to test "PHP" or the > server configuration here. There's test elsewhere for this. Instead > you should mock the upload process. E.g. the most simple thing to > "fake" an upload progress meter is a while(1) {} loop which sets the > appropriate variables.
The problem here is how to get the mocked file transfer adapter into your form. If you are using configuration files, you could potentially load your form via configuration and specify the alternate adapter there. > I think you can pretty much override anything in userland -- $_FILES, etc.. Not true. $_FILES and the various upload file functions provided by PHP are very... touchy... about being directly manipulated. This has caused a ton of headaches for Thomas while developing Zend_File_Transfer. -- Matthew Weier O'Phinney Software Architect | [email protected] Zend Framework | http://framework.zend.com/
