diff --git a/tests/libraries.test b/tests/libraries.test index 2a2e2cf..caeae0e 100644 --- a/tests/libraries.test +++ b/tests/libraries.test @@ -302,19 +302,53 @@ class LibrariesTestCase extends DrupalWebTestCase { // Test that the wrong files are not loaded. foreach ($names as $filename) { - foreach ($extensions as $extension) { - $message = "$filename.$extension not found"; - $message = ($label !== '' ? "$label: $message" : $message); - $this->assertNoRaw("$filename.$extension", $message); - } - } + // JavaScript. + // Construct the filename as it appears in the DOM. + $filepath = url(drupal_get_path('module', 'libraries_test') . "/example/$filename.js", array('absolute' => TRUE)); + $filepath .= '?' . variable_get('css_js_query_string'); + $html = ''; + $message = "$filename.js not found"; + $message = ($label !== '' ? "$label: $message" : $message); + $this->assertNoRaw($html, $message); - // Test that the correct files are loaded. - foreach ($extensions as $extension) { - $message = "$name.$extension found"; + // CSS. + $filepath = url(drupal_get_path('module', 'libraries_test') . "/example/$filename.css", array('absolute' => TRUE)); + $filepath .= '?' . variable_get('css_js_query_string'); + $html = '@import url(' . $filepath . ');'; + $message = "$filename.css not found"; $message = ($label !== '' ? "$label: $message" : $message); - $this->assertRaw("$name.$extension", $message); + $this->assertNoRaw($html, $message); + + // PHP. + $filepath = url(drupal_get_path('module', 'libraries_test') . "/example/$filename.php"); + $message = "$filename.php not found"; + $message = ($label !== '' ? "$label: $message" : $message); + $this->assertNoRaw('
  • ' . $filepath . '
  • ', $message); } + + // Test that the correct files are loaded. + // JavaScript. + // Construct the filename as it appears in the DOM. + $filepath = url(drupal_get_path('module', 'libraries_test') . "/example/$name.js", array('absolute' => TRUE)); + $filepath .= '?' . variable_get('css_js_query_string'); + $html = ''; + $message = "$name.js found"; + $message = ($label !== '' ? "$label: $message" : $message); + $this->assertRaw($html, $message); + + // CSS. + $filepath = url(drupal_get_path('module', 'libraries_test') . "/example/$name.css", array('absolute' => TRUE)); + $filepath .= '?' . variable_get('css_js_query_string'); + $html = '@import url(' . $filepath . ');'; + $message = "$name.css found"; + $message = ($label !== '' ? "$label: $message" : $message); + $this->assertRaw($html, $message); + + // PHP. + $filepath = url(drupal_get_path('module', 'libraries_test') . "/example/$name.php"); + $message = "$name.php found"; + $message = ($label !== '' ? "$label: $message" : $message); + $this->assertRaw('
  • ' . $filepath . '
  • ', $message); } } diff --git a/tests/libraries_test.module b/tests/libraries_test.module index 4893b11..1f593b5 100644 --- a/tests/libraries_test.module +++ b/tests/libraries_test.module @@ -489,7 +489,7 @@ function _libraries_test_load($library, $variant = NULL) { $files = get_included_files(); foreach ($files as $file) { if (strpos($file, 'libraries/test') && !strpos($file, 'libraries_test.module')) { - $output .= '
  • ' . strstr($file, 'libraries/test') . '
  • '; + $output .= '
  • ' . str_replace(DRUPAL_ROOT, '', $file) . '
  • '; } } $output .= '';