function OpenIDFunctionalTestCase::addIdentity

Add OpenID identity to user's profile.

Parameters

$identity: The User-supplied Identifier.

$version: The protocol version used by the service.

$local_id: The expected OP-Local Identifier found during discovery.

$claimed_id: The expected Claimed Identifier returned by the OpenID Provider, or FALSE if the discovery is expected to fail.

8 calls to OpenIDFunctionalTestCase::addIdentity()
OpenIDFunctionalTestCase::addRedirectedIdentity in modules/openid/openid.test
Add OpenID identity, changed by the following redirects, to user's profile.
OpenIDFunctionalTestCase::testBlockedUserLogin in modules/openid/openid.test
Test that a blocked user cannot log in.
OpenIDFunctionalTestCase::testDelete in modules/openid/openid.test
Test deleting an OpenID identity from a user's profile.
OpenIDFunctionalTestCase::testDiscovery in modules/openid/openid.test
Test discovery of OpenID Provider Endpoint via Yadis and HTML.
OpenIDFunctionalTestCase::testLogin in modules/openid/openid.test
Test login using OpenID.

... See full list

File

modules/openid/openid.test, line 286

Class

OpenIDFunctionalTestCase
Test discovery and login using OpenID

Code

function addIdentity($identity, $version = 2, $local_id = 'http://example.com/xrds', $claimed_id = NULL) {
    // Tell openid_test.module to only accept this OP-Local Identifier.
    variable_set('openid_test_identity', $local_id);
    $edit = array(
        'openid_identifier' => $identity,
    );
    $this->drupalPost('user/' . $this->web_user->uid . '/openid', $edit, t('Add an OpenID'));
    if ($claimed_id === FALSE) {
        $this->assertRaw(t('Sorry, that is not a valid OpenID. Ensure you have spelled your ID correctly.'), 'Invalid identity was rejected.');
        return;
    }
    // OpenID 1 used a HTTP redirect, OpenID 2 uses a HTML form that is submitted automatically using JavaScript.
    if ($version == 2) {
        // Check we are on the OpenID redirect form.
        $this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
        // Submit form to the OpenID Provider Endpoint.
        $this->drupalPost(NULL, array(), t('Send'));
    }
    if (!isset($claimed_id)) {
        $claimed_id = $identity;
    }
    $this->assertRaw(t('Successfully added %identity', array(
        '%identity' => $claimed_id,
    )), format_string('Identity %identity was added.', array(
        '%identity' => $identity,
    )));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.