Friday, March 30, 2012

Email mock not working

Hello,

I'm trying to use the mock when testing the e-mail sender. But it's
not working.
My code is:

$Users = $this->generate('Users', array('components' => array(
'Email' => array(
'sendConfirmationEmail'))));

$Users->Email->expects($this->once())->method('sendConfirmationEmail')-
>will($this->returnValue(true));

I'm using the EmailComponent in the UsersController, and the
sendConfirmationEmail is the method I want to mock. Can anybody help
me?

Thanks,
Thiago

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