News Feed
Sections




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

Chris Hartjes' Blog:
Testing Controllers Hiding Behind Zend_Auth
June 04, 2010 @ 13:13:50

On his blog today Chris Hartjes has a new post about testing your Zend Framework application's functionality that lives behind a Zend_Auth authentication.

The initial problem though was how do I simulate logging in a user so I can see this page, which was protected by authentication using Zend_Auth. So I started my scouring the internet for answers.

I found quite a few examples on how to test a controller, using the $this->dispatch('/path/to/action') method but found that I wasn't getting redirected properly to the post-login page. I was passing proper credentials in and everything. Then finally after deciding to go back to basics and read up on just how to test Zend_Auth. After some swearing a few face-palms, I realized what I had been doing wrong.

He includes the ultimately successful code for the test that uses a "loginUser" method to handle the authentication and ensure that the user is correctly logged in.

0 comments voice your opinion now!
zendframework zendauth controller unittest


blog comments powered by Disqus

Similar Posts

Community News: Fav.or.it Launch (Built on the Zend Framework)

MaltBlue.com: Zend Framework - How To Implement RSS Feeds the Easy Way

Padraic Brady's Blog: An Example Zend Framework Blog - Part 5: Models w/Zend_Db & an Admin Module

CodeSnipers.com: Stupidly Easy MVC - Group Membership Application (Part 2)

ZendCasts.com: Working with ZendX_JQuery


Community Events

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


example laravel conference symfony2 api community introduction voicesoftheelephpant performance part2 interview application configure podcast library framework php7 series opinion release

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