You are here

function JavaScriptTestCase::testLibraryUnknown in Drupal 7

Tests non-existing libraries.

File

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

Class

JavaScriptTestCase
Tests for the JavaScript system.

Code

function testLibraryUnknown() {
  $result = drupal_get_library('unknown', 'unknown');
  $this
    ->assertFalse($result, 'Unknown library returned FALSE.');
  drupal_static_reset('drupal_get_library');
  $result = drupal_add_library('unknown', 'unknown');
  $this
    ->assertFalse($result, 'Unknown library returned FALSE.');
  $scripts = drupal_get_js();
  $this
    ->assertTrue(strpos($scripts, 'unknown') === FALSE, 'Unknown library was not added to the page.');
}