You are here

protected function ConflictWebTestCase::drupalSwitchUser in Conflict 7

Helper function to switch between user1 and user2.

Parameters

stdClass $account: Link to drupal user.

Return value

bool As we are supporting concurrent session we are expecting valid session in given account. So try to work with existed.

2 calls to ConflictWebTestCase::drupalSwitchUser()
ConflictWebTestCase::drupalLogin in ./conflict.test
Overrides DrupalWebTestCase::drupalLogin().
ConflictWebTestCase::drupalLogout in ./conflict.test
Overrides DrupalWebTestCase::drupalLogout().

File

./conflict.test, line 47
Tests for conflict.module.

Class

ConflictWebTestCase
@file Tests for conflict.module.

Code

protected function drupalSwitchUser(stdClass $account) {
  if (isset($account->session)) {

    // Switch to the user session.
    $this->loggedInUser = $account;
    $this->curlHandle = $account->session->curlHandle;

    // Restore internal browser state of the user.
    // Updates content properties on $this as well as $this->loggedInUser.
    $this
      ->drupalSetContent($account->session->content, $account->session->url);
    return TRUE;
  }
  return FALSE;
}