public function OAuth2ClientTestCase::serverSideFlow in OAuth2 Client 7
Same name and namespace in other branches
- 7.2 tests/oauth2_client.test \OAuth2ClientTestCase::serverSideFlow()
Test the server-side flow.
For this test we are using 'client2' which has automatic authorization enabled.
1 call to OAuth2ClientTestCase::serverSideFlow()
File
- tests/
oauth2_client.test, line 81 - OAuth2 Client tests.
Class
- OAuth2ClientTestCase
- Test OAuth2 Client.
Code
public function serverSideFlow() {
$user = (object) array(
'name' => 'user1',
'pass_raw' => 'pass1',
);
$this
->drupalLogin($user);
$token1 = $this
->getToken('server-side-auto');
$token2 = $this
->getToken('server-side-auto');
$this
->assertEqual($token1, $token2, 'The same cached token is used, while it has not expired yet.');
sleep(10);
// wait for the token to expire
$token3 = $this
->getToken('server-side-auto');
$this
->assertNotEqual($token1, $token3, 'Getting a new token from refresh_token.');
sleep(30);
// wait for the refresh_token to expire
$token4 = $this
->getToken('server-side-auto');
}