OpenIDRegistrationTestCase::testRegisterUserWithoutEmailVerification

7 openid.test OpenIDRegistrationTestCase::testRegisterUserWithoutEmailVerification()
8 openid.test OpenIDRegistrationTestCase::testRegisterUserWithoutEmailVerification()

Test OpenID auto-registration with e-mail verification disabled.

File

modules/openid/openid.test, line 446
Tests for openid.module.

Code

function testRegisterUserWithoutEmailVerification() {
  variable_set('user_email_verification', FALSE);

  // 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->assertLink(t('Log out'), 0, t('User was logged in.'));

  $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->drupalLogout();

  $this->submitLoginForm($identity);
  $this->assertLink(t('Log out'), 0, t('User was logged in.'));
}
Login or register to post comments