OpenIDFunctionalTestCase::testLogin

7 openid.test OpenIDFunctionalTestCase::testLogin()
8 openid.test OpenIDFunctionalTestCase::testLogin()

Test login using OpenID.

File

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

Code

function testLogin() {
  $this->drupalLogin($this->web_user);

  // Use a User-supplied Identity that is the URL of an XRDS document.
  $identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
  $this->addIdentity($identity);

  $this->drupalLogout();

  // Test logging in via the login block on the front page.
  $this->submitLoginForm($identity);
  $this->assertLink(t('Log out'), 0, t('User was logged in.'));

  $this->drupalLogout();

  // Test logging in via the user/login page.
  $edit = array('openid_identifier' => $identity);
  $this->drupalPost('user/login', $edit, t('Log in'));

  // Check we are on the OpenID redirect form.
  $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));

  // Submit form to the OpenID Provider Endpoint.
  $this->drupalPost(NULL, array(), t('Send'));

  $this->assertLink(t('Log out'), 0, t('User was logged in.'));

  // Verify user was redirected away from user/login to an accessible page.
  $this->assertResponse(200);
}
Login or register to post comments