|
2 | 2 |
|
3 | 3 | **For additional reference, please review the [source](https://github.com/Codeception/Codeception/tree/2.0/src/Codeception/Module/Facebook.php)** |
4 | 4 |
|
5 | | - |
6 | | -Provides testing for projects integrated with Facebook API. |
7 | | -Relies on Facebook's tool Test User API. |
8 | 5 |
|
9 | | -<div class="alert alert-info"> |
10 | | -To use this module with Composer you need <em>"facebook/php-sdk": "3.*"</em> package. |
11 | | -</div> |
| 6 | +Provides testing for projects integrated with Facebook API. |
| 7 | +Relies on Facebook's tool Test User API. |
12 | 8 |
|
13 | | -## Status |
| 9 | +<div class="alert alert-info"> |
| 10 | +To use this module with Composer you need <em>"facebook/php-sdk": "3.*"</em> package. |
| 11 | +</div> |
14 | 12 |
|
15 | | -* Maintainer: **tiger-seo** |
16 | | -* Stability: **beta** |
17 | | -* Contact: tiger.seo@gmail.com |
| 13 | +## Status |
18 | 14 |
|
19 | | -## Config |
| 15 | +* Maintainer: **tiger-seo** |
| 16 | +* Stability: **beta** |
| 17 | +* Contact: tiger.seo@gmail.com |
20 | 18 |
|
21 | | -* app_id *required* - Facebook application ID |
22 | | -* secret *required* - Facebook application secret |
23 | | -* test_user - Facebook test user parameters: |
24 | | - * name - You can specify a name for the test user you create. The specified name will also be used in the email address assigned to the test user. |
25 | | - * locale - You can specify a locale for the test user you create, the default is en_US. The list of supported locales is available at https://www.facebook.com/translations/FacebookLocales.xml |
26 | | - * permissions - An array of permissions. Your app is granted these permissions for the new test user. The full list of permissions is available at https://developers.facebook.com/docs/authentication/permissions |
| 19 | +## Config |
27 | 20 |
|
28 | | -### Config example |
| 21 | +* app_id *required* - Facebook application ID |
| 22 | +* secret *required* - Facebook application secret |
| 23 | +* test_user - Facebook test user parameters: |
| 24 | + * name - You can specify a name for the test user you create. The specified name will also be used in the email address assigned to the test user. |
| 25 | + * locale - You can specify a locale for the test user you create, the default is en_US. The list of supported locales is available at https://www.facebook.com/translations/FacebookLocales.xml |
| 26 | + * permissions - An array of permissions. Your app is granted these permissions for the new test user. The full list of permissions is available at https://developers.facebook.com/docs/authentication/permissions |
29 | 27 |
|
30 | | - modules: |
31 | | - enabled: [Facebook] |
32 | | - config: |
33 | | - Facebook: |
34 | | - app_id: 412345678901234 |
35 | | - secret: ccb79c1b0fdff54e4f7c928bf233aea5 |
36 | | - test_user: |
37 | | - name: FacebookGuy |
38 | | - locale: uk_UA |
39 | | - permissions: [email, publish_stream] |
| 28 | +### Config example |
40 | 29 |
|
41 | | -### Test example: |
| 30 | + modules: |
| 31 | + enabled: [Facebook] |
| 32 | + config: |
| 33 | + Facebook: |
| 34 | + app_id: 412345678901234 |
| 35 | + secret: ccb79c1b0fdff54e4f7c928bf233aea5 |
| 36 | + test_user: |
| 37 | + name: FacebookGuy |
| 38 | + locale: uk_UA |
| 39 | + permissions: [email, publish_stream] |
42 | 40 |
|
43 | | -``` php |
44 | | -<?php |
45 | | -$I = new ApiGuy($scenario); |
46 | | -$I->am('Guest'); |
47 | | -$I->wantToTest('check-in to a place be published on the Facebook using API'); |
48 | | -$I->haveFacebookTestUserAccount(); |
49 | | -$accessToken = $I->grabFacebookTestUserAccessToken(); |
50 | | -$I->haveHttpHeader('Auth', 'FacebookToken ' . $accessToken); |
51 | | -$I->amGoingTo('send request to the backend, so that it will publish on user\'s wall on Facebook'); |
52 | | -$I->sendPOST('/api/v1/some-api-endpoint'); |
53 | | -$I->seePostOnFacebookWithAttachedPlace('167724369950862'); |
| 41 | +### Test example: |
54 | 42 |
|
55 | | -``` |
| 43 | +``` php |
| 44 | +<?php |
| 45 | +$I = new ApiGuy($scenario); |
| 46 | +$I->am('Guest'); |
| 47 | +$I->wantToTest('check-in to a place be published on the Facebook using API'); |
| 48 | +$I->haveFacebookTestUserAccount(); |
| 49 | +$accessToken = $I->grabFacebookTestUserAccessToken(); |
| 50 | +$I->haveHttpHeader('Auth', 'FacebookToken ' . $accessToken); |
| 51 | +$I->amGoingTo('send request to the backend, so that it will publish on user\'s wall on Facebook'); |
| 52 | +$I->sendPOST('/api/v1/some-api-endpoint'); |
| 53 | +$I->seePostOnFacebookWithAttachedPlace('167724369950862'); |
56 | 54 |
|
57 | | -``` php |
58 | | -<?php |
59 | | -$I = new WebGuy($scenario); |
60 | | -$I->am('Guest'); |
61 | | -$I->wantToTest('log in to site using Facebook'); |
62 | | -$I->haveFacebookTestUserAccount(); // create facebook test user |
63 | | -$I->haveTestUserLoggedInOnFacebook(); // so that facebook will not ask us for login and password |
64 | | -$fbUserFirstName = $I->grabFacebookTestUserFirstName(); |
65 | | -$I->amOnPage('/welcome'); |
66 | | -$I->see('Welcome, Guest'); |
67 | | -$I->click('Login with Facebook'); |
68 | | -$I->see('Welcome, ' . $fbUserFirstName); |
| 55 | +``` |
69 | 56 |
|
70 | | -``` |
| 57 | +``` php |
| 58 | +<?php |
| 59 | +$I = new WebGuy($scenario); |
| 60 | +$I->am('Guest'); |
| 61 | +$I->wantToTest('log in to site using Facebook'); |
| 62 | +$I->haveFacebookTestUserAccount(); // create facebook test user |
| 63 | +$I->haveTestUserLoggedInOnFacebook(); // so that facebook will not ask us for login and password |
| 64 | +$fbUserFirstName = $I->grabFacebookTestUserFirstName(); |
| 65 | +$I->amOnPage('/welcome'); |
| 66 | +$I->see('Welcome, Guest'); |
| 67 | +$I->click('Login with Facebook'); |
| 68 | +$I->see('Welcome, ' . $fbUserFirstName); |
71 | 69 |
|
72 | | -@since 1.6.3 |
73 | | -@author tiger.seo@gmail.com |
| 70 | +``` |
| 71 | + |
| 72 | +@since 1.6.3 |
| 73 | +@author tiger.seo@gmail.com |
74 | 74 |
|
75 | 75 |
|
76 | 76 |
|
@@ -124,56 +124,56 @@ $I->see('Welcome, ' . $fbUserFirstName); |
124 | 124 |
|
125 | 125 | ### grabFacebookTestUserAccessToken |
126 | 126 |
|
127 | | -Returns the test user access token. |
| 127 | +Returns the test user access token. |
128 | 128 |
|
129 | | -@return string |
| 129 | +@return string |
130 | 130 |
|
131 | 131 |
|
132 | 132 | ### grabFacebookTestUserEmail |
133 | 133 |
|
134 | | -Returns the test user email. |
| 134 | +Returns the test user email. |
135 | 135 |
|
136 | | -@return string |
| 136 | +@return string |
137 | 137 |
|
138 | 138 |
|
139 | 139 | ### grabFacebookTestUserFirstName |
140 | 140 |
|
141 | | -Returns the test user first name. |
| 141 | +Returns the test user first name. |
142 | 142 |
|
143 | | -@return string |
| 143 | +@return string |
144 | 144 |
|
145 | 145 |
|
146 | 146 | ### grabFacebookTestUserLoginUrl |
147 | 147 |
|
148 | | -Returns URL for test user auto-login. |
| 148 | +Returns URL for test user auto-login. |
149 | 149 |
|
150 | | -@return string |
| 150 | +@return string |
151 | 151 |
|
152 | 152 |
|
153 | 153 |
|
154 | 154 | ### haveFacebookTestUserAccount |
155 | 155 |
|
156 | | -Get facebook test user be created. |
| 156 | +Get facebook test user be created. |
157 | 157 |
|
158 | | -*Please, note that the test user is created only at first invoke, unless $renew arguments is true.* |
| 158 | +*Please, note that the test user is created only at first invoke, unless $renew arguments is true.* |
159 | 159 |
|
160 | | - * `param bool` $renew true if the test user should be recreated |
| 160 | + * `param bool` $renew true if the test user should be recreated |
161 | 161 |
|
162 | 162 |
|
163 | 163 | ### haveTestUserLoggedInOnFacebook |
164 | 164 |
|
165 | | -Get facebook test user be logged in on facebook. |
| 165 | +Get facebook test user be logged in on facebook. |
166 | 166 |
|
167 | | - ModuleConfigException |
| 167 | + ModuleConfigException |
168 | 168 |
|
169 | 169 |
|
170 | 170 |
|
171 | 171 |
|
172 | 172 | ### seePostOnFacebookWithAttachedPlace |
173 | 173 |
|
174 | 174 |
|
175 | | -Please, note that you must have publish_stream permission to be able to publish to user's feed. |
| 175 | +Please, note that you must have publish_stream permission to be able to publish to user's feed. |
176 | 176 |
|
177 | | - * `param string` $placeId Place identifier to be verified against user published posts |
| 177 | + * `param string` $placeId Place identifier to be verified against user published posts |
178 | 178 |
|
179 | 179 | <p> </p><div class="alert alert-warning">Module reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/tree/2.0/src/Codeception/Module/Facebook.php">Help us to improve documentation. Edit module reference</a></div> |
0 commit comments