> This method of testing is slightly better than testing the individual
> action controllers as it allows you to take into account the entire
> request environment

Yes, I definitely need to look into this! Thanks again :)



On Mon, Jun 16, 2008 at 7:01 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
wrote:

> -- Federico Cargnelutti <[EMAIL PROTECTED]> wrote
> (on Monday, 16 June 2008, 12:06 PM +0100):
> > I was writing a more high level and user friendly interface to speed up
> the
> > development of modules, when I realized that in the manual you are
> calling the
> > render() method within the action controller. While this might seem a
> > reasonable thing to do, I was thinking, how are other developers going to
> test
> > the action controllers? Or how am I going to format and validate the
> output
> > before a view is rendered and echoed to the browser?
>
> render() proxies to a method in the ViewRenderer, which calls the view
> object's render() method -- which returns a string. That string is then
> stored in the response object. So, there are no problems here.
>
> > So, my question is, should the action controller be responsible for
> rendering
> > and echoing the Views, or is this something that needs to be delegated to
> a
> > different component? For example, I've changed:
> >
> > $view = new Zend_View;
> > $view->render( str filename );
> >
> > $view = $this->getView( str filename [, module ] );
> > return $view;
> >
> > This allows me to test the each action method against a View object, and
> also,
> > format the output and validate the code using 3rd party libraries, such
> as
> > HTML_Purifier and PHP_CodeSniffer.
>
> You can attach filter objects to Zend_View for doing this... Check out
> the documentation for more information on this.
>
> > So, has anyone experienced this before? How are you testing your action
> > controllers?
>
> These days, using the new MVC assertions I've been working up. ;-)
>
>
> http://framework.zend.com/wiki/display/ZFPROP/Zend_Controller+Testing+Infrastructure
>
> http://framework.zend.com/svn/framework/standard/branches/user/matthew/mvcTesting
>
> Basically, I have a set of assertions that allow you to check the final
> response content against a variety of CSS selector or XPath assertions,
> as well as check for specific headers, redirects, or response codes.
> This method of testing is slightly better than testing the individual
> action controllers as it allows you to take into account the entire
> request environment -- routing, dispatching, layouts, any plugins you
> have, registered helpers, etc.
>
> --
> Matthew Weier O'Phinney
> Software Architect       | [EMAIL PROTECTED]
> Zend Framework           | http://framework.zend.com/
>

Reply via email to