function CommonURLWebTest::testInternalPathMimicsExternal

Tests the url() function on internal paths which mimic external URLs.

File

modules/simpletest/tests/common.test, line 414

Class

CommonURLWebTest
Web tests for URL generation functions.

Code

function testInternalPathMimicsExternal() {
    // Ensure that calling url(current_path()) on "/http://example.com" (an
    // internal path which mimics an external URL) always links to the internal
    // path, not the external URL. This helps protect against external URL link
    // injection vulnerabilities.
    variable_set('common_test_link_to_current_path', TRUE);
    $this->drupalGet('/http://example.com');
    $this->clickLink('link which should point to the current path');
    $this->assertUrl('/http://example.com');
    $this->assertText('link which should point to the current path');
}

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