libraries_test_module.module 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <?php
  2. /**
  3. * @file
  4. * Tests the library detection and loading.
  5. */
  6. /**
  7. * Implements hook_libraries_info().
  8. */
  9. function libraries_test_module_libraries_info() {
  10. // Test library information gathering.
  11. $libraries['example_module'] = array(
  12. 'name' => 'Example module',
  13. 'module_altered' => FALSE,
  14. );
  15. // Test library detection.
  16. $libraries['example_missing'] = array(
  17. 'name' => 'Example missing',
  18. // Provide a vendor and download URL to test that the UI links to it.
  19. 'vendor url' => 'http://example.com',
  20. 'download url' => 'http://example.com/download',
  21. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/missing',
  22. );
  23. $libraries['example_undetected_version'] = array(
  24. 'name' => 'Example undetected version',
  25. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  26. 'version callback' => '_libraries_test_module_return_version',
  27. 'version arguments' => array(FALSE),
  28. );
  29. $libraries['example_unsupported_version'] = array(
  30. 'name' => 'Example unsupported version',
  31. // Provide a download URL to test that the UI links to it.
  32. 'download url' => 'http://example.com/download',
  33. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  34. 'version callback' => '_libraries_test_module_return_version',
  35. 'version arguments' => array('1'),
  36. 'versions' => array(
  37. '2' => array(),
  38. ),
  39. );
  40. $libraries['example_supported_version'] = array(
  41. 'name' => 'Example supported version',
  42. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  43. 'version callback' => '_libraries_test_module_return_version',
  44. 'version arguments' => array('1'),
  45. 'versions' => array(
  46. '1' => array(),
  47. ),
  48. );
  49. // Test the default version callback.
  50. $libraries['example_default_version_callback'] = array(
  51. 'name' => 'Example default version callback',
  52. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  53. 'version arguments' => array(
  54. 'file' => 'README.txt',
  55. // Version 1
  56. 'pattern' => '/Version (\d+)/',
  57. 'lines' => 5,
  58. ),
  59. );
  60. // Test a multiple-parameter version callback.
  61. $libraries['example_multiple_parameter_version_callback'] = array(
  62. 'name' => 'Example multiple parameter version callback',
  63. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  64. // Version 1
  65. 'version callback' => '_libraries_test_module_get_version',
  66. 'version arguments' => array('README.txt', '/Version (\d+)/', 5),
  67. );
  68. // Test a top-level files property.
  69. $libraries['example_files'] = array(
  70. 'name' => 'Example files',
  71. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  72. 'version' => '1',
  73. 'files' => array(
  74. 'js' => array('example_1.js'),
  75. 'css' => array('example_1.css'),
  76. 'php' => array('example_1.php'),
  77. ),
  78. );
  79. // Test loading of integration files.
  80. // Normally added by the corresponding module via hook_libraries_info_alter(),
  81. // these files should be automatically loaded when the library is loaded.
  82. $libraries['example_module_integration_files'] = array(
  83. 'name' => 'Example module integration files',
  84. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  85. 'version' => '1',
  86. 'integration files' => array(
  87. 'libraries_test_module' => array(
  88. 'js' => array('libraries_test_module.js'),
  89. 'css' => array('libraries_test_module.css'),
  90. 'php' => array('libraries_test_module.inc'),
  91. ),
  92. ),
  93. );
  94. // Test loading of integration files after library files.
  95. // We test the correct loading order by calling a function that is defined in
  96. // example_1.php in libraries_test_module_post_load.inc.
  97. $libraries['example_module_integration_files_post_load'] = array(
  98. 'name' => 'Example module post-load integration files',
  99. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  100. 'version' => '1',
  101. 'files' => array(
  102. 'php' => array('example_1.php'),
  103. ),
  104. 'integration files' => array(
  105. 'libraries_test_module' => array(
  106. 'php' => array('libraries_test_module_post_load.inc'),
  107. ),
  108. ),
  109. 'post-load integration files' => TRUE,
  110. );
  111. // Test version overloading.
  112. $libraries['example_versions'] = array(
  113. 'name' => 'Example versions',
  114. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  115. 'version' => '2',
  116. 'versions' => array(
  117. '1' => array(
  118. 'files' => array(
  119. 'js' => array('example_1.js'),
  120. 'css' => array('example_1.css'),
  121. 'php' => array('example_1.php'),
  122. ),
  123. ),
  124. '2' => array(
  125. 'files' => array(
  126. 'js' => array('example_2.js'),
  127. 'css' => array('example_2.css'),
  128. 'php' => array('example_2.php'),
  129. ),
  130. ),
  131. ),
  132. );
  133. // Test variant detection.
  134. $libraries['example_variant_missing'] = array(
  135. 'name' => 'Example variant missing',
  136. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  137. 'version' => '1',
  138. 'variants' => array(
  139. 'example_variant' => array(
  140. 'files' => array(
  141. 'js' => array('example_3.js'),
  142. 'css' => array('example_3.css'),
  143. 'php' => array('example_3.php'),
  144. ),
  145. 'variant callback' => '_libraries_test_module_return_installed',
  146. 'variant arguments' => array(FALSE),
  147. ),
  148. ),
  149. );
  150. $libraries['example_variant'] = array(
  151. 'name' => 'Example variant',
  152. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  153. 'version' => '1',
  154. 'variants' => array(
  155. 'example_variant' => array(
  156. 'files' => array(
  157. 'js' => array('example_3.js'),
  158. 'css' => array('example_3.css'),
  159. 'php' => array('example_3.php'),
  160. ),
  161. 'variant callback' => '_libraries_test_module_return_installed',
  162. 'variant arguments' => array(TRUE),
  163. ),
  164. ),
  165. );
  166. // Test correct behaviour with multiple versions and multiple variants.
  167. $libraries['example_versions_and_variants'] = array(
  168. 'name' => 'Example versions and variants',
  169. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  170. 'version' => '2',
  171. 'versions' => array(
  172. '1' => array(
  173. 'variants' => array(
  174. 'example_variant_1' => array(
  175. 'files' => array(
  176. 'js' => array('example_1.js'),
  177. 'css' => array('example_1.css'),
  178. 'php' => array('example_1.php'),
  179. ),
  180. 'variant callback' => '_libraries_test_module_return_installed',
  181. 'variant arguments' => array(TRUE),
  182. ),
  183. 'example_variant_2' => array(
  184. 'files' => array(
  185. 'js' => array('example_2.js'),
  186. 'css' => array('example_2.css'),
  187. 'php' => array('example_2.php'),
  188. ),
  189. 'variant callback' => '_libraries_test_module_return_installed',
  190. 'variant arguments' => array(TRUE),
  191. ),
  192. ),
  193. ),
  194. '2' => array(
  195. 'variants' => array(
  196. 'example_variant_1' => array(
  197. 'files' => array(
  198. 'js' => array('example_3.js'),
  199. 'css' => array('example_3.css'),
  200. 'php' => array('example_3.php'),
  201. ),
  202. 'variant callback' => '_libraries_test_module_return_installed',
  203. 'variant arguments' => array(TRUE),
  204. ),
  205. 'example_variant_2' => array(
  206. 'files' => array(
  207. 'js' => array('example_4.js'),
  208. 'css' => array('example_4.css'),
  209. 'php' => array('example_4.php'),
  210. ),
  211. 'variant callback' => '_libraries_test_module_return_installed',
  212. 'variant arguments' => array(TRUE),
  213. ),
  214. ),
  215. ),
  216. ),
  217. );
  218. // Test dependency loading.
  219. // We add one file to each library to be able to verify if it was loaded with
  220. // libraries_load().
  221. // This library acts as a dependency for the libraries below.
  222. $libraries['example_dependency'] = array(
  223. 'name' => 'Example dependency',
  224. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  225. 'version' => '1.1',
  226. 'files' => array('js' => array('example_1.js')),
  227. );
  228. $libraries['example_dependency_missing'] = array(
  229. 'name' => 'Example dependency missing',
  230. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  231. 'version' => '1',
  232. 'dependencies' => array('example_missing'),
  233. 'files' => array('js' => array('example_1.js')),
  234. );
  235. $libraries['example_dependency_incompatible'] = array(
  236. 'name' => 'Example dependency incompatible',
  237. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  238. 'version' => '1',
  239. 'dependencies' => array('example_dependency (>1.1)'),
  240. 'files' => array('js' => array('example_1.js')),
  241. );
  242. $libraries['example_dependency_compatible'] = array(
  243. 'name' => 'Example dependency compatible',
  244. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  245. 'version' => '1',
  246. 'dependencies' => array('example_dependency (>=1.1)'),
  247. 'files' => array('js' => array('example_1.js')),
  248. );
  249. // Test the applying of callbacks.
  250. $libraries['example_callback'] = array(
  251. 'name' => 'Example callback',
  252. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  253. 'version' => '1',
  254. 'versions' => array(
  255. '1' => array(
  256. 'variants' => array(
  257. 'example_variant' => array(
  258. // These keys are for testing purposes only.
  259. 'info callback' => 'not applied',
  260. 'pre-detect callback' => 'not applied',
  261. 'post-detect callback' => 'not applied',
  262. 'pre-dependencies-load callback' => 'not applied',
  263. 'pre-load callback' => 'not applied',
  264. 'post-load callback' => 'not applied',
  265. ),
  266. ),
  267. // These keys are for testing purposes only.
  268. 'info callback' => 'not applied',
  269. 'pre-detect callback' => 'not applied',
  270. 'post-detect callback' => 'not applied',
  271. 'pre-dependencies-load callback' => 'not applied',
  272. 'pre-load callback' => 'not applied',
  273. 'post-load callback' => 'not applied',
  274. ),
  275. ),
  276. 'variants' => array(
  277. 'example_variant' => array(
  278. // These keys are for testing purposes only.
  279. 'info callback' => 'not applied',
  280. 'pre-detect callback' => 'not applied',
  281. 'post-detect callback' => 'not applied',
  282. 'pre-dependencies-load callback' => 'not applied',
  283. 'pre-load callback' => 'not applied',
  284. 'post-load callback' => 'not applied',
  285. ),
  286. ),
  287. 'callbacks' => array(
  288. 'info' => array('_libraries_test_module_info_callback'),
  289. 'pre-detect' => array('_libraries_test_module_pre_detect_callback'),
  290. 'post-detect' => array('_libraries_test_module_post_detect_callback'),
  291. 'pre-dependencies-load' => array('_libraries_test_module_pre_dependencies_load_callback'),
  292. 'pre-load' => array('_libraries_test_module_pre_load_callback'),
  293. 'post-load' => array('_libraries_test_module_post_load_callback'),
  294. ),
  295. // These keys are for testing purposes only.
  296. 'info callback' => 'not applied',
  297. 'pre-detect callback' => 'not applied',
  298. 'post-detect callback' => 'not applied',
  299. 'pre-dependencies-load callback' => 'not applied',
  300. 'pre-load callback' => 'not applied',
  301. 'post-load callback' => 'not applied',
  302. );
  303. $libraries['example_path_variable_override'] = array(
  304. 'name' => 'Example path variable override',
  305. 'library path' => drupal_get_path('module', 'libraries') . '/tests/libraries/example',
  306. 'version' => '1',
  307. 'files' => array(
  308. 'php' => array('example_1.php', 'example_2.php'),
  309. ),
  310. );
  311. return $libraries;
  312. }
  313. /**
  314. * Implements hook_libraries_info_alter().
  315. */
  316. function libraries_test_module_libraries_info_alter(&$libraries) {
  317. $libraries['example_module']['module_altered'] = TRUE;
  318. }
  319. /**
  320. * Implements hook_libraries_info_file_paths()
  321. */
  322. function libraries_test_module_libraries_info_file_paths() {
  323. return array(drupal_get_path('module', 'libraries') . '/tests/libraries');
  324. }
  325. /**
  326. * Gets the version of an example library.
  327. *
  328. * Returns exactly the version string entered as the $version parameter. This
  329. * function cannot be collapsed with _libraries_test_module_return_installed(),
  330. * because of the different arguments that are passed automatically.
  331. */
  332. function _libraries_test_module_return_version($library, $version) {
  333. return $version;
  334. }
  335. /**
  336. * Gets the version information from an arbitrary library.
  337. *
  338. * Test function for a version callback with multiple arguments. This is an
  339. * exact copy of libraries_get_version(), which uses a single $option argument,
  340. * except for the fact that it uses multiple arguments. Since we support both
  341. * type of version callbacks, detecting the version of a test library with this
  342. * function ensures that the arguments are passed correctly. This function might
  343. * be a useful reference for a custom version callback that uses multiple
  344. * parameters.
  345. *
  346. * @param $library
  347. * An associative array containing all information about the library.
  348. * @param $file
  349. * The filename to parse for the version, relative to the library path. For
  350. * example: 'docs/changelog.txt'.
  351. * @param pattern
  352. * A string containing a regular expression (PCRE) to match the library
  353. * version. For example: '/@version (\d+)\.(\d+)/'.
  354. * @param lines
  355. * (optional) The maximum number of lines to search the pattern in. Defaults
  356. * to 20.
  357. * @param cols
  358. * (optional) The maximum number of characters per line to take into account.
  359. * Defaults to 200. In case of minified or compressed files, this prevents
  360. * reading the entire file into memory.
  361. *
  362. * @return
  363. * A string containing the version of the library.
  364. *
  365. * @see libraries_get_version()
  366. */
  367. function _libraries_test_module_get_version($library, $file, $pattern, $lines = 20, $cols = 200) {
  368. $file = DRUPAL_ROOT . '/' . $library['library path'] . '/' . $file;
  369. if (!file_exists($file)) {
  370. return;
  371. }
  372. $file = fopen($file, 'r');
  373. while ($lines && $line = fgets($file, $cols)) {
  374. if (preg_match($pattern, $line, $version)) {
  375. fclose($file);
  376. return $version[1];
  377. }
  378. $lines--;
  379. }
  380. fclose($file);
  381. }
  382. /**
  383. * Detects the variant of an example library.
  384. *
  385. * Returns exactly the value of $installed, either TRUE or FALSE. This function
  386. * cannot be collapsed with _libraries_test_module_return_version(), because of
  387. * the different arguments that are passed automatically.
  388. */
  389. function _libraries_test_module_return_installed($library, $name, $installed) {
  390. return $installed;
  391. }
  392. /**
  393. * Sets the 'info callback' key.
  394. *
  395. * This function is used as a test callback for the 'info' callback group.
  396. *
  397. * @see _libraries_test_module_callback()
  398. */
  399. function _libraries_test_module_info_callback(&$library, $version, $variant) {
  400. _libraries_test_module_callback($library, $version, $variant, 'info');
  401. }
  402. /**
  403. * Sets the 'pre-detect callback' key.
  404. *
  405. * This function is used as a test callback for the 'pre-detect' callback group.
  406. *
  407. * @see _libraries_test_module_callback()
  408. */
  409. function _libraries_test_module_pre_detect_callback(&$library, $version, $variant) {
  410. _libraries_test_module_callback($library, $version, $variant, 'pre-detect');
  411. }
  412. /**
  413. * Sets the 'post-detect callback' key.
  414. *
  415. * This function is used as a test callback for the 'post-detect callback group.
  416. *
  417. * @see _libraries_test_module_callback()
  418. */
  419. function _libraries_test_module_post_detect_callback(&$library, $version, $variant) {
  420. _libraries_test_module_callback($library, $version, $variant, 'post-detect');
  421. }
  422. /**
  423. * Sets the 'pre-dependencies-load callback' key.
  424. *
  425. * This function is used as a test callback for the 'pre-dependencies-load'
  426. * callback group.
  427. *
  428. * @see _libraries_test_module_callback()
  429. */
  430. function _libraries_test_module_pre_dependencies_load_callback(&$library, $version, $variant) {
  431. _libraries_test_module_callback($library, $version, $variant, 'pre-dependencies-load');
  432. }
  433. /**
  434. * Sets the 'pre-load callback' key.
  435. *
  436. * This function is used as a test callback for the 'pre-load' callback group.
  437. *
  438. * @see _libraries_test_module_callback()
  439. */
  440. function _libraries_test_module_pre_load_callback(&$library, $version, $variant) {
  441. _libraries_test_module_callback($library, $version, $variant, 'pre-load');
  442. }
  443. /**
  444. * Sets the 'post-load callback' key.
  445. *
  446. * This function is used as a test callback for the 'post-load' callback group.
  447. *
  448. * @see _libraries_test_module_callback()
  449. */
  450. function _libraries_test_module_post_load_callback(&$library, $version, $variant) {
  451. _libraries_test_module_callback($library, $version, $variant, 'post-load');
  452. }
  453. /**
  454. * Sets the '[group] callback' key, where [group] is prepare, detect, or load.
  455. *
  456. * This function is used as a test callback for the all callback groups.
  457. *
  458. * It sets the '[group] callback' (see above) key to 'applied ([part])' where
  459. * [part] is either 'top-level', 'version x.y' (where x.y is the passed-in
  460. * version string), 'variant example' (where example is the passed-in variant
  461. * name), or 'version x.y, variant example' (see above), depending on the part
  462. * of the library the passed-in library information belongs to.
  463. *
  464. * @param $library
  465. * An array of library information, which may be version- or variant-specific.
  466. * Passed by reference.
  467. * @param $version
  468. * The version the library information passed in $library belongs to, or NULL
  469. * if the passed library information is not version-specific.
  470. * @param $variant
  471. * The variant the library information passed in $library belongs to, or NULL
  472. * if the passed library information is not variant-specific.
  473. */
  474. function _libraries_test_module_callback(&$library, $version, $variant, $group) {
  475. $string = 'applied';
  476. if (isset($version) && isset($variant)) {
  477. $string .= " (version $version, variant $variant)";
  478. }
  479. elseif (isset($version)) {
  480. $string .= " (version $version)";
  481. }
  482. elseif (isset($variant)) {
  483. $string .= " (variant $variant)";
  484. }
  485. else {
  486. $string .= ' (top-level)';
  487. }
  488. $library["$group callback"] = $string;
  489. // The following is used to test caching of library information.
  490. // Only set the message for the top-level library to prevent confusing,
  491. // duplicate messages.
  492. if (!isset($version) && !isset($variant) && variable_get('libraries_test_module_cache', FALSE)) {
  493. drupal_set_message("The <em>$group</em> callback group was invoked.");
  494. }
  495. }
  496. /**
  497. * Implements hook_menu().
  498. */
  499. function libraries_test_module_menu() {
  500. $base = array(
  501. 'page callback' => '_libraries_test_module_load',
  502. 'access callback' => TRUE,
  503. );
  504. $items['libraries-test-module/files'] = $base + array(
  505. 'title' => 'Test files',
  506. 'page arguments' => array('example_files'),
  507. );
  508. $items['libraries-test-module/module-integration-files'] = $base + array(
  509. 'title' => 'Test module integration files',
  510. 'page arguments' => array('example_module_integration_files'),
  511. );
  512. $items['libraries-test-module/module-integration-files-post-load'] = $base + array(
  513. 'title' => 'Test module post-load integration files',
  514. 'page arguments' => array('example_module_integration_files_post_load'),
  515. );
  516. $items['libraries-test-module/theme-integration-files'] = $base + array(
  517. 'title' => 'Test theme integration files',
  518. 'page arguments' => array('example_theme_integration_files'),
  519. );
  520. $items['libraries-test-module/versions'] = $base + array(
  521. 'title' => 'Test version loading',
  522. 'page arguments' => array('example_versions'),
  523. );
  524. $items['libraries-test-module/variant'] = $base + array(
  525. 'title' => 'Test variant loading',
  526. 'page arguments' => array('example_variant', 'example_variant'),
  527. );
  528. $items['libraries-test-module/versions-and-variants'] = $base + array(
  529. 'title' => 'Test concurrent version and variant loading',
  530. 'page arguments' => array('example_versions_and_variants', 'example_variant_2'),
  531. );
  532. $items['libraries-test-module/cache'] = $base + array(
  533. 'title' => 'Test caching of library information',
  534. 'page arguments' => array('example_callback'),
  535. );
  536. return $items;
  537. }
  538. /**
  539. * Loads a specified library (variant) for testing.
  540. *
  541. * JavaScript and CSS files can be checked directly by SimpleTest, so we only
  542. * need to manually check for PHP files. We provide information about the loaded
  543. * JavaScript and CSS files for easier debugging. See example/README.txt for
  544. * more information.
  545. */
  546. function _libraries_test_module_load($library, $variant = NULL) {
  547. libraries_load($library, $variant);
  548. // JavaScript and CSS files can be checked directly by SimpleTest, so we only
  549. // need to manually check for PHP files.
  550. $output = '';
  551. // For easer debugging of JS loading, a text is shown that the JavaScript will
  552. // replace.
  553. $output .= '<h2>JavaScript</h2>';
  554. $output .= '<div class="libraries-test-module-js">';
  555. $output .= 'If this text shows up, no JavaScript test file was loaded.';
  556. $output .= '</div>';
  557. // For easier debugging of CSS loading, the loaded CSS files will color the
  558. // following text.
  559. $output .= '<h2>CSS</h2>';
  560. $output .= '<div class="libraries-test-module-css">';
  561. $output .= 'If one of the CSS test files has been loaded, this text will be colored:';
  562. $output .= '<ul>';
  563. // Do not reference the actual CSS files (i.e. including '.css'), because that
  564. // breaks testing.
  565. $output .= '<li>example_1: red</li>';
  566. $output .= '<li>example_2: green</li>';
  567. $output .= '<li>example_3: orange</li>';
  568. $output .= '<li>example_4: blue</li>';
  569. $output .= '<li>libraries_test_module: purple</li>';
  570. $output .= '<li>libraries_test_theme: turquoise</li>';
  571. $output .= '</ul>';
  572. $output .= '</div>';
  573. $output .= '<h2>PHP</h2>';
  574. $output .= '<div class="libraries-test-module-php">';
  575. $output .= 'The following is a list of all loaded test PHP files:';
  576. $output .= '<ul>';
  577. $files = get_included_files();
  578. foreach ($files as $file) {
  579. if (strpos($file, 'libraries/test') && !strpos($file, 'libraries_test_module.module') && !strpos($file, 'template.php')) {
  580. $output .= '<li>' . str_replace(DRUPAL_ROOT . '/', '', $file) . '</li>';
  581. }
  582. }
  583. $output .= '</ul>';
  584. $output .= '</div>';
  585. return $output;
  586. }
  587. /**
  588. * Implements hook_system_theme_info().
  589. */
  590. function libraries_test_module_system_theme_info() {
  591. $themes = array();
  592. $themes['libraries_test_theme'] = drupal_get_path('module', 'libraries') . '/tests/themes/libraries_test_theme/libraries_test_theme.info';
  593. return $themes;
  594. }