3 namespace Drupal\libraries\Tests;
5 use Drupal\simpletest\KernelTestBase;
8 * Tests basic Libraries API functions.
12 class LibrariesUnitTest extends KernelTestBase {
17 public static $modules = array('libraries');
20 * Tests libraries_get_path().
22 function testLibrariesGetPath() {
23 // Note that, even though libraries_get_path() doesn't find the 'example'
24 // library, we are able to make it 'installed' by specifying the 'library
25 // path' up-front. This is only used for testing purposed and is strongly
26 // discouraged as it defeats the purpose of Libraries API in the first
28 $this->assertEqual(libraries_get_path('example'), FALSE, 'libraries_get_path() returns FALSE for a missing library.');
32 * Tests libraries_prepare_files().
34 function testLibrariesPrepareFiles() {
37 'js' => array('example.js' => array()),
38 'css' => array('example.css' => array()),
39 'php' => array('example.php' => array()),
44 'js' => array('example.js'),
45 'css' => array('example.css'),
46 'php' => array('example.php'),
49 libraries_prepare_files($library, NULL, NULL);
50 $this->assertEqual($expected, $library, 'libraries_prepare_files() works correctly.');