You are here

function JavaScriptTestCase::testAddFile in SimpleTest 7

Test adding a JavaScript file.

File

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

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testAddFile() {
  $javascript = drupal_add_js('misc/collapse.js');
  $this
    ->assertTrue(array_key_exists('misc/jquery.js', $javascript), t('jQuery is added when a file is added.'));
  $this
    ->assertTrue(array_key_exists('misc/drupal.js', $javascript), t('Drupal.js is added when file is added.'));
  $this
    ->assertTrue(array_key_exists('misc/collapse.js', $javascript), t('JavaScript files are correctly added.'));
  $this
    ->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], t('Base path JavaScript setting is correctly set.'));
}