function JavaScriptTest::testLibraryUnknown

Tests non-existing libraries.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php, line 487
Definition of Drupal\system\Tests\Common\JavaScriptTest.

Class

JavaScriptTest
Tests the JavaScript system.

Namespace

Drupal\system\Tests\Common

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.');
}