You are here

function JavaScriptTestCase::testRenderExternal in Drupal 7

Test rendering an external JavaScript file.

File

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

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testRenderExternal() {
  $external = 'http://example.com/example.js';
  drupal_add_js($external, 'external');
  $javascript = drupal_get_js();

  // Local files have a base_path() prefix, external files should not.
  $this
    ->assertTrue(strpos($javascript, 'src="' . $external) > 0, 'Rendering an external JavaScript file.');
}