News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell's Blog:
PHPUnit with Zend_Controller_Action_Helper
July 23, 2009 @ 07:50:20

Lorna Mitchell has posted about another aspect of the REST project she's been developing and an issue that's come up with testing with PHPUnit.

I ran into problems very quickly - when I tried to write the first unit test for the first action in fact! PHPUnit was just dying when I asked it to dispatch() any URL which didn't return HTML, it wasn't even giving its usual output. What was actually happening was I was making use of Zend_Controller_Action_Helper_Json, my service returns JSON and this action helper takes input, transforms it into JSON, sets the content-type correctly and tells ZF not to look for a view since we don't need one. I thought this was pretty neat.

As it turns out, there was an exit being called in the Zend_Controller_Action_Helper_Json component that was causing the request to stop at a certain point. The solution? Chaning the value of the supressExit class variable to stop the behavior.

0 comments voice your opinion now!
json action helper zendframework unittest phpunit


blog comments powered by Disqus

Similar Posts

Pádraic Brady's Blog: OpenID library for the Zend Framework?

Padraic Brady's Blog: ZF Blog App - Part 4: Design with Blueprint CSS & Zend_Layout

Juozas Kaziukenas' Blog: Starting with Zend_Search_Lucene

Padraic Brady's Blog: Services_Oauth and Zend_Oauth Revisited

Juan Treminio: Unit Testing Tutorial Part V: Mock Methods and Overriding Constructors


Community Events





Don't see your event here?
Let us know!


developer configure introduction language podcast list install library threedevsandamaybe code unittest interview release wordpress bugfix laravel community api application series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework