Rodrigo is right. By mocking the save method you are basically saying that that method does nothing, unless you specify a return value. Mocking the save method is probably not the way to go. If you're using a test database and fixtures, the data will be stored in a database and wiped clean when the test is finished. This way, your tests always start with the same records and stay away from the production database. Also, it tests the physical act of saving the data in a database, which is what you want to do.
Setting up a test database: http://book.cakephp.org/2.0/en/development/testing.html#test-database-setup Setting up fixtures: http://book.cakephp.org/2.0/en/development/testing.html#fixtures On Thursday, April 26, 2012 5:40:05 AM UTC-7, Rodrigo Rodrigues Moyle wrote: > > If you use a mock on model, the data is not saved to database and the > findByGuest is always false. -- 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
