1 common.test CommonJavaScriptTestCase::testGetLibrary()

Tests retrieval of libraries via backdrop_get_library().

File

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

Class

CommonJavaScriptTestCase
Tests for the JavaScript system.

Code

function testGetLibrary() {
  // Retrieve all libraries registered by a module.
  $libraries = backdrop_get_library('common_test');
  $this->assertTrue(isset($libraries['farbtastic']), 'Retrieved all module libraries.');
  // Retrieve all libraries for a module not implementing hook_library_info().
  // Note: This test installs Locale module.
  $libraries = backdrop_get_library('locale');
  $this->assertEqual($libraries, array(), 'Retrieving libraries from a module not implementing hook_library_info() returns an empty array.');

  // Retrieve a specific library by module and name.
  $farbtastic = backdrop_get_library('common_test', 'farbtastic');
  $this->assertEqual($farbtastic['version'], '5.3', 'Retrieved a single library.');
  // Retrieve a non-existing library by module and name.
  $farbtastic = backdrop_get_library('common_test', 'foo');
  $this->assertIdentical($farbtastic, FALSE, 'Retrieving a non-existing library returns FALSE.');
}