Hi Martin, > I was wondering if anyone had some tips for a good way to write a test > for a Controller or Component that performs an outgoing request? > Ordinary models and things are so much more self-contained and > therefore usually not a big problem writing tests for. > > In my case I a talking about a Component that performs SOAP calls to > an "outside" server, a Controller that works like a router/gateway > (incoming requests trigger calls to different sub-servers determined > by the content of the request and a stored list of available sub- > servers). It does this using simple curl. > > I would like to be able to write a test for these to determine of the > correct SOAP-endpoint or http-address is contacted... without actually > contacting them. I can configure the endpoints to be somewhere o > localhost for the tests but I don't know how I would then make the > testcase capture that request and compare it to my expected result. > > Another more common example would be an email-component where you > might want to test if the correct SMTP is contacted without sending a > bunch of emails.
Maybe you can solve it with mock objects: http://www.simpletest.org/en/mock_objects_documentation.html Hope that helps! -- Daniel Hofstetter http://cakebaker.42dh.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---