function ConflictSwitchExampleTestCase::testConcurrentLogin in Conflict 7
Test internal concurrent session functional.
File
- ./
conflict.test, line 199 - Tests for conflict.module.
Class
Code
function testConcurrentLogin() {
// Login first user.
$this
->drupalLogin($this->user1);
$this
->assertText($this->user1->name);
$this
->clickLink(t('Edit'));
// Login second user.
// Without passing TRUE, the first user would be logged out.
$this
->drupalLogin($this->user2, TRUE);
$this
->assertText($this->user2->name);
$this
->clickLink(t('Edit'));
// Switch to first user.
$this
->drupalLogin($this->user1);
// Verify that we ARE user1 and SEE what user1 saw before.
$this
->assertText($this->user1->name);
$this
->assertFieldByName('mail', $this->user1->mail);
// Switch to second user.
$this
->drupalLogin($this->user2);
// Verify that we ARE user2 and SEE what user2 saw before.
$this
->assertText($this->user2->name);
$this
->assertFieldByName('mail', $this->user2->mail);
// Log out second user.
$this
->drupalLogout();
// Switch back to first user and confirm that we're still logged in.
$this
->drupalLogin($this->user1);
// Verify that we ARE user1 and SEE what user1 saw before.
$this
->assertText($this->user1->name);
$this
->assertFieldByName('mail', $this->user1->mail);
// Log the second user back in (was logged out above).
// Without passing TRUE, the first user would be logged out.
$this
->drupalLogin($this->user2, TRUE);
$this
->assertText($this->user2->name);
$this
->clickLink(t('Edit'));
// Switch back to first user once more.
$this
->drupalLogin($this->user1);
// Verify that we ARE user1 and SEE what user1 saw before.
$this
->assertText($this->user1->name);
$this
->assertFieldByName('mail', $this->user1->mail);
}