You are here

function OpenIDTestCase::testOpenidNormalize in Drupal 7

Test openid_normalize().

File

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

Class

OpenIDTestCase
Test internal helper functions.

Code

function testOpenidNormalize() {

  // Test that the normalization is according to OpenID Authentication 2.0,
  // section 7.2 and 11.5.2.
  $this
    ->assertEqual(openid_normalize('$foo'), '$foo', 'openid_normalize() correctly normalized an XRI.');
  $this
    ->assertEqual(openid_normalize('xri://$foo'), '$foo', 'openid_normalize() correctly normalized an XRI with an xri:// scheme.');
  $this
    ->assertEqual(openid_normalize('example.com/'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with a missing scheme.');
  $this
    ->assertEqual(openid_normalize('example.com'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with a missing scheme and empty path.');
  $this
    ->assertEqual(openid_normalize('http://example.com'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with an empty path.');
  $this
    ->assertEqual(openid_normalize('http://example.com/path'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a path.');
  $this
    ->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a fragment.');
}