Mark Story gave the solution in a CakePHP ticket. The problem is specific with expectations in static methods, and `AuthComponent::user()` is static.
When mocking a static method in PHPUnit `staticExpects(...) should be used instead of `expects()`. On Dec 3, 9:12 am, elitalon <[email protected]> wrote: > 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 <[email protected]> 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
