Further modules included.
[yaffs-website] / web / modules / contrib / libraries / src / Tests / LibrariesUnitTest.php
1 <?php
2
3 namespace Drupal\libraries\Tests;
4
5 use Drupal\simpletest\KernelTestBase;
6
7 /**
8  * Tests basic Libraries API functions.
9  *
10  * @group libraries
11  */
12 class LibrariesUnitTest extends KernelTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = array('libraries');
18
19   /**
20    * Tests libraries_get_path().
21    */
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
27     // place.
28     $this->assertEqual(libraries_get_path('example'), FALSE, 'libraries_get_path() returns FALSE for a missing library.');
29   }
30
31   /**
32    * Tests libraries_prepare_files().
33    */
34   function testLibrariesPrepareFiles() {
35     $expected = array(
36       'files' => array(
37         'js' => array('example.js' => array()),
38         'css' => array('example.css' => array()),
39         'php' => array('example.php' => array()),
40       ),
41     );
42     $library = array(
43       'files' => array(
44         'js' => array('example.js'),
45         'css' => array('example.css'),
46         'php' => array('example.php'),
47       ),
48     );
49     libraries_prepare_files($library, NULL, NULL);
50     $this->assertEqual($expected, $library, 'libraries_prepare_files() works correctly.');
51   }
52
53 }