Yes, of course you can, and should, test your controllers.

The authorization service is just a dipendency like any other, and
your controller should not be aware of its implementation.
When dealing with testing units of work that rely on dependencies, you
usually mock the dependency, inject it where needed, execute the unit,
and then run assertions on the Subject Under Test.
Sometimes it may get more complicated than that, and that usually
rings a bell about design issues like a not SOLID enough architecture.

The abstract TestCase provided by the framework is there to make your
life easier with setup and assertions on Controllers, so by all means
use that, but most of it is aimed to functional testing. I strongly
suggest to get unit tests straight before delving into functional.

Stefano Torresi

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to