How do I write test cases in PHPUnit for code that is using the Auth module with basic authentication? I have found bits and pieces of information about it but does anyone know of a step by step howto or detailed documentation?
My code limits certain actions to certain user types so it calls the Auth->login method and then gets the user object from Auth ($User = $this->Auth->user()) and then checks the group_id ($User['group_id']). There seem to be two approaches to this: 1. Mock the User object and the Auth component 2. Read the User information from the database and call Auth->login explicitly in the test setup Which approach is "best practice"? Are there some cases where it is better to use one over the other? Unfortunately, I have no real experience using PHPUnit or other unit testing frameworks. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.