Thursday, March 27, 2014

Re: Testing a logged in user

Thanks Mark. How do I incorporate —stderr into tests run via the web, rather than from the command line?

On 27 Mar 2014, at 10:45, euromark <dereuromark@gmail.com> wrote:

Yes, you can simple use the Session to store and "fake" a logged in user.
Just make sure you dont forget --stderr to append to your test command. Otherwise the session based tests will fail.


Am Donnerstag, 27. März 2014 11:43:54 UTC+1 schrieb Jeremy Burns:
I've read and searched and am stumped. I have set up test cases and fixtures for my (built) models and controllers. I want to run a controller test that logs in a specific user (who exists in my users fixture) and then run a controller action. I want to test that the displayed values meet expectations. Lots of answers point to using generate to mock objects, but - unless I'm being really dumb here - I don't need to mock anything. The users controller exists and it includes both the Auth and Session components (from AppController). Can anyone point me in the right direction, please?

--
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+unsubscribe@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/d/optout.

No comments: