function JavaScriptTestCase::testRenderExternal
Test rendering an external JavaScript file.
File
-
modules/
simpletest/ tests/ common.test, line 1650
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.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.