diff --git a/tests/src/Functional/LibrariesWebTest.php b/tests/src/Functional/LibrariesWebTest.php index 883b5aaf959b8c9054d5eaac7570ee322503fd4f..c1090947c8972f83974eeafc253b2847fae3743d 100644 --- a/tests/src/Functional/LibrariesWebTest.php +++ b/tests/src/Functional/LibrariesWebTest.php @@ -64,14 +64,14 @@ class LibrariesWebTest extends BrowserTestBase { 'dependencies' => ['Example missing'], ]; libraries_detect_dependencies($library); - $this->assertEqual($library['error'], 'missing dependency', 'libraries_detect_dependencies() detects missing dependency'); + $this->assertEquals($library['error'], 'missing dependency', 'libraries_detect_dependencies() detects missing dependency'); $error_message = t('The %dependency library, which the %library library depends on, is not installed.', [ '%dependency' => 'Example missing', '%library' => $library['name'], ]); $this->verbose("Expected:<br>$error_message"); $this->verbose('Actual:<br>' . $library['error message']); - $this->assertEqual($library['error message'], $error_message, 'Correct error message for a missing dependency'); + $this->assertEquals($library['error message'], $error_message, 'Correct error message for a missing dependency'); // Test versioned dependencies. $version = '1.1'; $compatible = [ @@ -118,7 +118,7 @@ class LibrariesWebTest extends BrowserTestBase { $library['installed'] = TRUE; unset($library['error'], $library['error message']); libraries_detect_dependencies($library); - $this->assertEqual($library['error'], 'incompatible dependency', "libraries_detect_dependencies() detects incompatible version strings: '$version_string' is incompatible with '$version'"); + $this->assertEquals($library['error'], 'incompatible dependency', "libraries_detect_dependencies() detects incompatible version strings: '$version_string' is incompatible with '$version'"); } // Instead of repeating this assertion for each version string, we just // re-use the $library variable from the foreach loop. @@ -129,7 +129,7 @@ class LibrariesWebTest extends BrowserTestBase { ]); $this->verbose("Expected:<br>$error_message"); $this->verbose('Actual:<br>' . $library['error message']); - $this->assertEqual($library['error message'], $error_message, 'Correct error message for an incompatible dependency'); + $this->assertEquals($library['error message'], $error_message, 'Correct error message for an incompatible dependency'); } /** @@ -146,7 +146,7 @@ class LibrariesWebTest extends BrowserTestBase { $actual = libraries_scan_info_files(); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($actual, TRUE) . '</pre>'); - $this->assertEqual($actual, $expected, 'libraries_scan_info_files() correctly finds the example info file.'); + $this->assertEquals($actual, $expected, 'libraries_scan_info_files() correctly finds the example info file.'); $this->verbose('<pre>' . var_export(libraries_scan_info_files(), TRUE) . '</pre>'); } @@ -170,7 +170,7 @@ class LibrariesWebTest extends BrowserTestBase { $library = libraries_info('example_files'); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library, $expected, 'Library information is correctly gathered.'); + $this->assertEquals($library, $expected, 'Library information is correctly gathered.'); // Test a library specified with an .info file gets detected. $expected = [ @@ -185,7 +185,7 @@ class LibrariesWebTest extends BrowserTestBase { unset($library['core'], $library['datestamp'], $library['project'], $library['version']); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library, $expected, 'Library specified with an .info file found'); + $this->assertEquals($library, $expected, 'Library specified with an .info file found'); } /** @@ -195,45 +195,45 @@ class LibrariesWebTest extends BrowserTestBase { // Test missing library. $library = libraries_detect('example_missing'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['error'], 'not found', 'Missing library not found.'); + $this->assertEquals($library['error'], 'not found', 'Missing library not found.'); $error_message = t('The %library library could not be found.', [ '%library' => $library['name'], ]); - $this->assertEqual($library['error message'], $error_message, 'Correct error message for a missing library.'); + $this->assertEquals($library['error message'], $error_message, 'Correct error message for a missing library.'); // Test unknown library version. $library = libraries_detect('example_undetected_version'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['error'], 'not detected', 'Undetected version detected as such.'); + $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->assertEqual($library['error message'], $error_message, 'Correct error message for a library with an undetected version.'); + $this->assertEquals($library['error message'], $error_message, 'Correct error message for a library with an undetected version.'); // Test unsupported library version. $library = libraries_detect('example_unsupported_version'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['error'], 'not supported', 'Unsupported version detected as such.'); + $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->assertEqual($library['error message'], $error_message, 'Correct error message for a library with an unsupported version.'); + $this->assertEquals($library['error message'], $error_message, 'Correct error message for a library with an unsupported version.'); // Test supported library version. $library = libraries_detect('example_supported_version'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['installed'], TRUE, 'Supported library version found.'); + $this->assertEquals($library['installed'], TRUE, 'Supported library version found.'); // Test libraries_get_version(). $library = libraries_detect('example_default_version_callback'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['version'], '1', 'Expected version returned by default version callback.'); + $this->assertEquals($library['version'], '1', 'Expected version returned by default version callback.'); // Test a multiple-parameter version callback. $library = libraries_detect('example_multiple_parameter_version_callback'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['version'], '1', 'Expected version returned by multiple parameter version callback.'); + $this->assertEquals($library['version'], '1', 'Expected version returned by multiple parameter version callback.'); // Test a top-level files property. $library = libraries_detect('example_files'); @@ -243,7 +243,7 @@ class LibrariesWebTest extends BrowserTestBase { 'php' => ['example_1.php' => []], ]; $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['files'], $files, 'Top-level files property works.'); + $this->assertEquals($library['files'], $files, 'Top-level files property works.'); // Test version-specific library files. $library = libraries_detect('example_versions'); @@ -253,22 +253,22 @@ class LibrariesWebTest extends BrowserTestBase { 'php' => ['example_2.php' => []], ]; $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['files'], $files, 'Version-specific library files found.'); + $this->assertEquals($library['files'], $files, 'Version-specific library files found.'); // Test missing variant. $library = libraries_detect('example_variant_missing'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['variants']['example_variant']['error'], 'not found', 'Missing variant not found'); + $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->assertEqual($library['variants']['example_variant']['error message'], $error_message, 'Correct error message for a missing variant.'); + $this->assertEquals($library['variants']['example_variant']['error message'], $error_message, 'Correct error message for a missing variant.'); // Test existing variant. $library = libraries_detect('example_variant'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['variants']['example_variant']['installed'], TRUE, 'Existing variant found.'); + $this->assertEquals($library['variants']['example_variant']['installed'], TRUE, 'Existing variant found.'); } /** @@ -286,10 +286,10 @@ class LibrariesWebTest extends BrowserTestBase { $this->assertFalse($library['loaded'], 'Library with incompatible dependency cannot be loaded'); $library = libraries_load('example_dependency_compatible'); $this->verbose('<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library['loaded'], 1, 'Library with compatible dependency is loaded'); + $this->assertEquals($library['loaded'], 1, 'Library with compatible dependency is loaded'); $loaded = &drupal_static('libraries_load'); $this->verbose('<pre>' . var_export($loaded, TRUE) . '</pre>'); - $this->assertEqual($loaded['example_dependency']['loaded'], 1, 'Dependency library is also loaded'); + $this->assertEquals($loaded['example_dependency']['loaded'], 1, 'Dependency library is also loaded'); } /** @@ -351,7 +351,7 @@ class LibrariesWebTest extends BrowserTestBase { $library = libraries_info('example_callback'); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library, $expected, 'Prepare callback was applied correctly.'); + $this->assertEquals($library, $expected, 'Prepare callback was applied correctly.'); // Test a callback in the 'pre-detect' and 'post-detect' phases. // Successfully detected libraries should only contain version information @@ -372,7 +372,7 @@ class LibrariesWebTest extends BrowserTestBase { $library = libraries_detect('example_callback'); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library, $expected, 'Detect callback was applied correctly.'); + $this->assertEquals($library, $expected, 'Detect callback was applied correctly.'); // Test a callback in the 'pre-load' and 'post-load' phases. // Successfully loaded libraries should only contain information about the @@ -384,7 +384,7 @@ class LibrariesWebTest extends BrowserTestBase { $library = libraries_load('example_callback'); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library, $expected, 'Pre-load and post-load callbacks were applied correctly.'); + $this->assertEquals($library, $expected, 'Pre-load and post-load callbacks were applied correctly.'); // This is not recommended usually and is only used for testing purposes. drupal_static_reset('libraries_load'); // Successfully loaded library variants are supposed to contain the specific @@ -395,7 +395,7 @@ class LibrariesWebTest extends BrowserTestBase { $library = libraries_load('example_callback', 'example_variant'); $this->verbose('Expected:<pre>' . var_export($expected, TRUE) . '</pre>'); $this->verbose('Actual:<pre>' . var_export($library, TRUE) . '</pre>'); - $this->assertEqual($library, $expected, 'Pre-detect and post-detect callbacks were applied correctly to a variant.'); + $this->assertEquals($library, $expected, 'Pre-detect and post-detect callbacks were applied correctly to a variant.'); } /** diff --git a/tests/src/Kernel/LibrariesApi/LibrariesUnitTest.php b/tests/src/Kernel/LibrariesApi/LibrariesUnitTest.php index 6ffc0127fcd39f7953e3ec5688decd80b02df771..ffcfa27b5aad238ff084c850d80b117eb9db1ce2 100644 --- a/tests/src/Kernel/LibrariesApi/LibrariesUnitTest.php +++ b/tests/src/Kernel/LibrariesApi/LibrariesUnitTest.php @@ -25,7 +25,7 @@ class LibrariesUnitTest extends KernelTestBase { // path' up-front. This is only used for testing purposed and is strongly // discouraged as it defeats the purpose of Libraries API in the first // place. - $this->assertEqual(libraries_get_path('example'), FALSE, 'libraries_get_path() returns FALSE for a missing library.'); + $this->assertEquals(libraries_get_path('example'), FALSE, 'libraries_get_path() returns FALSE for a missing library.'); } /** @@ -47,7 +47,7 @@ class LibrariesUnitTest extends KernelTestBase { ], ]; libraries_prepare_files($library, NULL, NULL); - $this->assertEqual($expected, $library, 'libraries_prepare_files() works correctly.'); + $this->assertEquals($expected, $library, 'libraries_prepare_files() works correctly.'); } }