function OpenIDTest::testOpenidNormalize

Test openid_normalize().

File

drupal/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTest.php, line 116
Definition of Drupal\openid\Tests\OpenIDTest.

Class

OpenIDTest
Test internal helper functions.

Namespace

Drupal\openid\Tests

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.');
}