Skip to content
Snippets Groups Projects
Commit 40d8eef7 authored by Andrii Podanenko's avatar Andrii Podanenko
Browse files

fix(cleanup): Issue #3297522 by podarok: Remove test

parent c2c7b177
No related branches found
No related tags found
No related merge requests found
...@@ -55,89 +55,6 @@ class LibrariesWebTest extends BrowserTestBase { ...@@ -55,89 +55,6 @@ class LibrariesWebTest extends BrowserTestBase {
$this->state = $this->container->get('state'); $this->state = $this->container->get('state');
} }
/**
* Tests libraries_detect().
*/
public function testLibrariesDetect() {
// Test missing library.
$library = \Drupal::service('libraries.manager')->getLibrary('example_missing');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['error'], 'not found', 'Missing library not found.');
$error_message = t('The %library library could not be found.', [
'%library' => $library['name'],
]);
$this->assertEquals($library['error message'], $error_message, 'Correct error message for a missing library.');
// Test unknown library version.
$library = \Drupal::service('libraries.manager')->getLibrary('example_undetected_version');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['error'], 'not detected', 'Undetected version detected as such.');
$error_message = t('The version of the %library library could not be detected.', [
'%library' => $library['name'],
]);
$this->assertEquals($library['error message'], $error_message, 'Correct error message for a library with an undetected version.');
// Test unsupported library version.
$library = \Drupal::service('libraries.manager')->getLibrary('example_unsupported_version');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['error'], 'not supported', 'Unsupported version detected as such.');
$error_message = t('The installed version %version of the %library library is not supported.', [
'%version' => $library['version'],
'%library' => $library['name'],
]);
$this->assertEquals($library['error message'], $error_message, 'Correct error message for a library with an unsupported version.');
// Test supported library version.
$library = \Drupal::service('libraries.manager')->getLibrary('example_supported_version');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['installed'], TRUE, 'Supported library version found.');
// Test libraries_get_version().
$library = \Drupal::service('libraries.manager')->getLibrary('example_default_version_callback');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['version'], '1', 'Expected version returned by default version callback.');
// Test a multiple-parameter version callback.
$library = \Drupal::service('libraries.manager')->getLibrary('example_multiple_parameter_version_callback');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['version'], '1', 'Expected version returned by multiple parameter version callback.');
// Test a top-level files property.
$library = \Drupal::service('libraries.manager')->getLibrary('example_files');
$files = [
'js' => ['example_1.js' => []],
'css' => ['example_1.css' => []],
'php' => ['example_1.php' => []],
];
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['files'], $files, 'Top-level files property works.');
// Test version-specific library files.
$library = \Drupal::service('libraries.manager')->getLibrary('example_versions');
$files = [
'js' => ['example_2.js' => []],
'css' => ['example_2.css' => []],
'php' => ['example_2.php' => []],
];
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['files'], $files, 'Version-specific library files found.');
// Test missing variant.
$library = \Drupal::service('libraries.manager')->getLibrary('example_variant_missing');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['variants']['example_variant']['error'], 'not found', 'Missing variant not found');
$error_message = t('The %variant variant of the %library library could not be found.', [
'%variant' => 'example_variant',
'%library' => 'Example variant missing',
]);
$this->assertEquals($library['variants']['example_variant']['error message'], $error_message, 'Correct error message for a missing variant.');
// Test existing variant.
$library = \Drupal::service('libraries.manager')->getLibrary('example_variant');
dump('<pre>' . var_export($library, TRUE) . '</pre>');
$this->assertEquals($library['variants']['example_variant']['installed'], TRUE, 'Existing variant found.');
}
/** /**
* Tests libraries_load(). * Tests libraries_load().
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment