SammyK / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
1 stars 2 forks source link

"In FacebookTest, unset the env fallback vars to not throw false positive." #2

Closed stevenmaguire closed 9 years ago

stevenmaguire commented 9 years ago

From the laundry list in #1, can you describe this in a bit more detail?

SammyK commented 9 years ago

Currently the Facebook\Facebook super service falls back to environment variables if you don't provide the config explicitly. Normally you'd provide the config like this:

$fb = new Facebook\Facebook([
    'app_id' => '{id}',
    'app_secret' => '{secret}',
]);

But if you have FACEBOOK_APP_ID and FACEBOOK_APP_SECRET env vars set, the SDK will just use those and you can do this:

$fb = new Facebook\Facebook();

And it will still work. The tests ensure that at minimum we have an app_id and app_secret, but if you happen to have the FACEBOOK_APP_ID and/or FACEBOOK_APP_SECRET env variables set in your testing environment, the expected throws won't throw here and/or here. So we just need to unset those env vars before the tests run to ensure the tests will still throw.

Does that make sense? :)

SammyK commented 9 years ago

PS: We should probably write tests to ensure the environment variable fallbacks work as well. lol.