Testing oAuth / facebook authentication with WebTestCase in Symfony2
Asked Answered
P

2

16

I'm trying to get a FacebookLoginTest running. Problem is: the Symfony2 client does not send real HTTP requests, so it does not work on URLs of other services (like facebook).

I know I could work with cUrl,... but I see so many obstacles there: session, javascript, redirects.

Any ideas how we could get this running? Anyone got a automatic oAuth test running?

Psychiatrist answered 12/5, 2011 at 10:20 Comment(2)
You should have a look to Facebook test users. They have a unique loginURL designed for automated testing. But those will only feet client-side testing for the same reasons you pointed out. developers.facebook.com/docs/test_usersMenashem
Facebook test users is a good idea. It's the user you'll log. But this is not how you can redirect to the login url.Yacano
E
1

Your best bet might be Goutte https://github.com/fabpot/Goutte which is a wrapper around the Sf2 components you're using combined with an HTTP client. Good luck!

Eulogist answered 25/6, 2012 at 21:46 Comment(1)
Goutte is not working for me. Seems like there is a lot of JS stuff going on in the facebook login form...Psychiatrist
S
0

curl should work just fine for this, and while it doesn't support javascript, you won't need js support for what you're trying to accomplish.

Shiv answered 12/6, 2012 at 14:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.