You are here

function FbconnectTestCase::testLogin in Facebook Connect 8.2

Same name and namespace in other branches
  1. 6.2 tests/fbconnect.test \FbconnectTestCase::testLogin()
  2. 7.2 tests/fbconnect.test \FbconnectTestCase::testLogin()

File

tests/fbconnect.test, line 91

Class

FbconnectTestCase
@file

Code

function testLogin() {
  $account = $this
    ->drupalCreateUser();
  $fb_user = $this
    ->_createFbTestUser('true', 'email');
  $edit = array(
    'fbuid' => $fb_user['id'],
    'access_token' => $fb_user['access_token'],
  );
  $this
    ->drupalPost('fbconnect-test/init-fb-session', $edit, 'Submit');
  $this
    ->assertFieldByName('fbuid', $fb_user['id'], 'FB Session inited', 'FBConnect');
  $this
    ->assertTrue(fbconnect_login_register($account->uid, $fb_user['id']), 'fbconnect_register returned true', 'FBConnect');
  $this
    ->assertNotNull(_get_user_fbuid($account->uid), 'FB Account is connected', 'FBConnect');
  $this
    ->drupalHead('fbconnect/authorize');
  $this
    ->assertLink('My account', 0, 'User is logged in', 'FBConnect');
}