Saturday, December 3, 2011

Re: Write unit test for a controller that uses AuthComponent in CakePHP 2.0.3

If you look at my last piece of code I am exactly doing that:

$this->Users = $this->generate('Users', array(
'components' => array('Session', 'Auth' => array('user'))
'models' => 'User'
));

However, the problem got fixed after rebooting the machine. I don't
know if it could be a cache issue. I opened a related ticket to this
but regarding to AuthComponent.

I am getting a little frustrated here, because when mocked models are
working fine, the AuthComponent seems to fail, and vice versa.

On Dec 3, 3:44 am, José Lorenzo <jose....@gmail.com> wrote:
> You also need to mock the models:
>
>  $this->controller = $this->generate('Users', array(
>         'components' => array('Auth' => array('user')),
>         'models' => array('User' => array('save')) // We mock the User
> Model's save method
>     ));

--
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: