1 common.test CommonURLWebTestCase::testInternalPathMimicsExternal()

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

File

core/modules/simpletest/tests/common.test, line 250
Tests for common.inc functionality.

Class

CommonURLWebTestCase
Tests for URL generation functions.

Code

function testInternalPathMimicsExternal() {
  module_enable(array('common_test'));
  // 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.
  state_set('common_test_link_to_current_path', TRUE);
  $this->backdropGet('/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');
}