|
@@ 125-144 (lines=20) @@
|
| 122 |
|
$this->assertEquals(static::TESTING_GRAPH_VERSION, $request->getGraphVersion()); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
public function testCanGetLongLivedAccessToken() |
| 126 |
|
{ |
| 127 |
|
$this->client->setAccessTokenResponse(); |
| 128 |
|
|
| 129 |
|
$accessToken = $this->oauth->getLongLivedAccessToken('short_token'); |
| 130 |
|
|
| 131 |
|
$this->assertEquals('my_access_token', $accessToken->getValue()); |
| 132 |
|
|
| 133 |
|
$expectedParams = [ |
| 134 |
|
'grant_type' => 'fb_exchange_token', |
| 135 |
|
'fb_exchange_token' => 'short_token', |
| 136 |
|
'client_id' => '123', |
| 137 |
|
'client_secret' => 'foo_secret', |
| 138 |
|
'access_token' => '123|foo_secret', |
| 139 |
|
'appsecret_proof' => 'de753c58fd58b03afca2340bbaeb4ecf987b5de4c09e39a63c944dd25efbc234', |
| 140 |
|
]; |
| 141 |
|
|
| 142 |
|
$request = $this->oauth->getLastRequest(); |
| 143 |
|
$this->assertEquals($expectedParams, $request->getParams()); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
public function testCanGetCodeFromLongLivedAccessToken() |
| 147 |
|
{ |
|
@@ 146-165 (lines=20) @@
|
| 143 |
|
$this->assertEquals($expectedParams, $request->getParams()); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
public function testCanGetCodeFromLongLivedAccessToken() |
| 147 |
|
{ |
| 148 |
|
$this->client->setCodeResponse(); |
| 149 |
|
|
| 150 |
|
$code = $this->oauth->getCodeFromLongLivedAccessToken('long_token', 'foo_uri'); |
| 151 |
|
|
| 152 |
|
$this->assertEquals('my_neat_code', $code); |
| 153 |
|
|
| 154 |
|
$expectedParams = [ |
| 155 |
|
'access_token' => 'long_token', |
| 156 |
|
'redirect_uri' => 'foo_uri', |
| 157 |
|
'client_id' => '123', |
| 158 |
|
'client_secret' => 'foo_secret', |
| 159 |
|
'appsecret_proof' => '7e91300ea91be4166282611d4fc700b473466f3ea2981dafbf492fc096995bf1', |
| 160 |
|
]; |
| 161 |
|
|
| 162 |
|
$request = $this->oauth->getLastRequest(); |
| 163 |
|
$this->assertEquals($expectedParams, $request->getParams()); |
| 164 |
|
$this->assertEquals('/oauth/client_code', $request->getEndpoint()); |
| 165 |
|
} |
| 166 |
|
} |
| 167 |
|
|