OpenIDRegistrationTestCase::testRegisterUserWithAXButNoSREG

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

Test OpenID auto-registration with a provider that supplies AX information, but no SREG.

File

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

Code

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

  // Tell openid_test.module to respond with these AX fields.
  variable_set('openid_test_response', array(
    'openid.ns.ext123' => 'http://openid.net/srv/ax/1.0', 
    'openid.ext123.type.mail456' => 'http://axschema.org/contact/email', 
    'openid.ext123.value.mail456' => 'john@example.com', 
    'openid.ext123.type.name789' => 'http://schema.openid.net/namePerson/friendly', 
    'openid.ext123.count.name789' => '1', 
    'openid.ext123.value.name789.1' => 'john',
  ));

  // 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.'));
}
Login or register to post comments