function JavaScriptTestCase::testLibraryUnknown

7.x common.test JavaScriptTestCase::testLibraryUnknown()

Tests non-existing libraries.

File

drupal-7.x/modules/simpletest/tests/common.test, line 1528
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.');
}