| 7 openid.test | OpenIDRegistrationTestCase::testRegisterUserWithEmailVerification() |
| 8 openid.test | OpenIDRegistrationTestCase::testRegisterUserWithEmailVerification() |
Test OpenID auto-registration with e-mail verification enabled.
File
- modules/
openid/ openid.test, line 411 - Tests for openid.module.
Code
function testRegisterUserWithEmailVerification() {
variable_set('user_email_verification', TRUE);
// Tell openid_test.module to respond with these SREG fields.
variable_set('openid_test_response', array('openid.sreg.nickname' => 'john', 'openid.sreg.email' => 'john@example.com'));
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
$this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
$this->assertRaw(t('A welcome message with further instructions has been sent to your e-mail address.'), t('A welcome message was sent to the user.'));
$reset_url = $this->getPasswordResetURLFromMail();
$user = user_load_by_name('john');
$this->assertTrue($user, t('User was registered with right username.'));
$this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
$this->assertFalse($user->data, t('No additional user info was saved.'));
$this->submitLoginForm($identity);
$this->assertRaw(t('You must validate your email address for this account before logging in via OpenID.'));
// Follow the one-time login that was sent in the welcome e-mail.
$this->drupalGet($reset_url);
$this->drupalPost(NULL, array(), t('Log in'));
$this->drupalLogout();
// Verify that the account was activated.
$this->submitLoginForm($identity);
$this->assertLink(t('Log out'), 0, t('User was logged in.'));
}
Login or register to post comments