Monday, August 22, 2011

Re: Testing Authentication/Authorization in 2.0

You need to specify which methods you need to mock for the components. For instance, you could only mock the user() method on the AuthComponent, and supply any return value for each of your calls on the method, in other to test authorization on it.

$this->generate('MyController', array('components' => array('Auth' => array('user'))));

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: