You are here

function JavaScriptTestCase::testHeaderSetting in SimpleTest 7

Test drupal_get_js() for JavaScript settings.

File

tests/common.test, line 1014
Tests for common.inc functionality.

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testHeaderSetting() {
  drupal_add_js(array(
    'testSetting' => 'testValue',
  ), 'setting');
  $javascript = drupal_get_js('header');
  $this
    ->assertTrue(strpos($javascript, 'basePath') > 0, t('Rendered JavaScript header returns basePath setting.'));
  $this
    ->assertTrue(strpos($javascript, 'testSetting') > 0, t('Rendered JavaScript header returns custom setting.'));
  $this
    ->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, t('Rendered JavaScript header includes jQuery.'));
}