Skip to content
Snippets Groups Projects
Commit 94c7904d authored by IMMACULATE X's avatar IMMACULATE X Committed by Andrii Podanenko
Browse files

Issue #3297522 by Project Update Bot, immaculatexavier: Automated Drupal 10 compatibility fixes

parent ec0c6401
No related branches found
No related tags found
No related merge requests found
Showing
with 127 additions and 121 deletions
...@@ -605,5 +605,5 @@ function hook_libraries_info_alter(&$libraries) { ...@@ -605,5 +605,5 @@ function hook_libraries_info_alter(&$libraries) {
function hook_libraries_info_file_paths() { function hook_libraries_info_file_paths() {
// Taken from the Libraries test module, which needs to specify the path to // Taken from the Libraries test module, which needs to specify the path to
// the test library. // the test library.
return [drupal_get_path('module', 'libraries_test') . '/example']; return [\Drupal::service('extension.list.module')->getPath('libraries_test') . '/example'];
} }
name: Libraries name: Libraries
type: module type: module
description: Allows version-dependent and shared usage of external libraries. description: Allows version-dependent and shared usage of external libraries.
core_version_requirement: ^8.8 || ^9 core_version_requirement: ^8.8 || ^9 || ^10
...@@ -117,7 +117,7 @@ function libraries_get_libraries() { ...@@ -117,7 +117,7 @@ function libraries_get_libraries() {
// profile, installation profiles may want to place libraries into a // profile, installation profiles may want to place libraries into a
// 'libraries' directory. // 'libraries' directory.
if ($profile = \Drupal::installProfile()) { if ($profile = \Drupal::installProfile()) {
$profile_path = drupal_get_path('profile', $profile); $profile_path = \Drupal::service('extension.list.profile')->getPath($profile);
$searchdir[] = "$profile_path/libraries"; $searchdir[] = "$profile_path/libraries";
}; };
...@@ -168,7 +168,7 @@ function libraries_get_libraries() { ...@@ -168,7 +168,7 @@ function libraries_get_libraries() {
* https://www.drupal.org/node/2170763 * https://www.drupal.org/node/2170763
*/ */
function libraries_scan_info_files() { function libraries_scan_info_files() {
$profile = drupal_get_path('profile', \Drupal::installProfile()); $profile = \Drupal::service('extension.list.profile')->getPath(\Drupal::installProfile());
$config = DrupalKernel::findSitePath(\Drupal::request()); $config = DrupalKernel::findSitePath(\Drupal::request());
// Build a list of directories. // Build a list of directories.
...@@ -808,7 +808,7 @@ function libraries_load_files($library) { ...@@ -808,7 +808,7 @@ function libraries_load_files($library) {
libraries_load_files([ libraries_load_files([
'files' => $files, 'files' => $files,
'path' => '', 'path' => '',
'library path' => drupal_get_path('module', $module), 'library path' => \Drupal::service('extension.list.module')->getPath($module),
]); ]);
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\libraries\Plugin\libraries\Locator; namespace Drupal\libraries\Plugin\libraries\Locator;
use Drupal\Core\StreamWrapper\LocalStream;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface; use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface; use Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface;
...@@ -73,7 +74,7 @@ class UriLocator implements LocatorInterface, ContainerFactoryPluginInterface { ...@@ -73,7 +74,7 @@ class UriLocator implements LocatorInterface, ContainerFactoryPluginInterface {
public function locate(LocalLibraryInterface $library) { public function locate(LocalLibraryInterface $library) {
/** @var \Drupal\Core\StreamWrapper\LocalStream $stream_wrapper */ /** @var \Drupal\Core\StreamWrapper\LocalStream $stream_wrapper */
$stream_wrapper = $this->streamWrapperManager->getViaUri($this->uri); $stream_wrapper = $this->streamWrapperManager->getViaUri($this->uri);
assert($stream_wrapper instanceof \Drupal\Core\StreamWrapper\LocalStream); assert($stream_wrapper instanceof LocalStream);
// Calling LocalStream::getDirectoryPath() explicitly avoids the realpath() // Calling LocalStream::getDirectoryPath() explicitly avoids the realpath()
// usage in LocalStream::getLocalPath(), which breaks if Libraries API is // usage in LocalStream::getLocalPath(), which breaks if Libraries API is
// symbolically linked into the Drupal installation. // symbolically linked into the Drupal installation.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\libraries\Plugin\libraries\Type; namespace Drupal\libraries\Plugin\libraries\Type;
use Drupal\libraries\ExternalLibrary\Asset\AssetLibraryInterface;
use Drupal\libraries\ExternalLibrary\Asset\AssetLibrary; use Drupal\libraries\ExternalLibrary\Asset\AssetLibrary;
use Drupal\libraries\ExternalLibrary\Asset\AttachableAssetLibraryRegistrationInterface; use Drupal\libraries\ExternalLibrary\Asset\AttachableAssetLibraryRegistrationInterface;
use Drupal\libraries\ExternalLibrary\LibraryInterface; use Drupal\libraries\ExternalLibrary\LibraryInterface;
...@@ -24,7 +25,7 @@ class AssetLibraryType extends LibraryTypeBase implements AttachableAssetLibrary ...@@ -24,7 +25,7 @@ class AssetLibraryType extends LibraryTypeBase implements AttachableAssetLibrary
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getAttachableAssetLibraries(LibraryInterface $library, LibraryManagerInterface $library_manager) { public function getAttachableAssetLibraries(LibraryInterface $library, LibraryManagerInterface $library_manager) {
assert($library instanceof \Drupal\libraries\ExternalLibrary\Asset\AssetLibraryInterface); assert($library instanceof AssetLibraryInterface);
/** @var \Drupal\libraries\ExternalLibrary\Asset\AssetLibraryInterface $library */ /** @var \Drupal\libraries\ExternalLibrary\Asset\AssetLibraryInterface $library */
return [$library->getId() => $library->getAttachableAssetLibrary($library_manager)]; return [$library->getId() => $library->getAttachableAssetLibrary($library_manager)];
} }
......
...@@ -25,7 +25,7 @@ class MultipleAssetLibraryType extends LibraryTypeBase implements AttachableAsse ...@@ -25,7 +25,7 @@ class MultipleAssetLibraryType extends LibraryTypeBase implements AttachableAsse
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getAttachableAssetLibraries(LibraryInterface $external_library, LibraryManagerInterface $library_manager) { public function getAttachableAssetLibraries(LibraryInterface $external_library, LibraryManagerInterface $library_manager) {
assert($external_library instanceof \Drupal\libraries\ExternalLibrary\Asset\MultipleAssetLibraryInterface); assert($external_library instanceof MultipleAssetLibraryInterface);
/** @var \Drupal\libraries\ExternalLibrary\Asset\MultipleAssetLibraryInterface $external_library */ /** @var \Drupal\libraries\ExternalLibrary\Asset\MultipleAssetLibraryInterface $external_library */
$attachable_libraries = []; $attachable_libraries = [];
foreach ($external_library->getAttachableAssetLibraries($library_manager) as $component_name => $attachable_library) { foreach ($external_library->getAttachableAssetLibraries($library_manager) as $component_name => $attachable_library) {
......
...@@ -56,7 +56,7 @@ class LinePatternDetector extends PluginBase implements VersionDetectorInterface ...@@ -56,7 +56,7 @@ class LinePatternDetector extends PluginBase implements VersionDetectorInterface
$configuration, $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
$container->get('app.root') $container->getParameter('app.root')
); );
} }
......
name: Libraries test module name: Libraries test module
type: module type: module
description: Tests library detection and loading. description: Tests library detection and loading.
core_version_requirement: ^8 || ^9 core_version_requirement: ^8 || ^9 || ^10
dependencies: dependencies:
- libraries:libraries - libraries:libraries
hidden: TRUE hidden: TRUE
......
...@@ -15,17 +15,17 @@ function libraries_test_libraries_info() { ...@@ -15,17 +15,17 @@ function libraries_test_libraries_info() {
// Test library detection. // Test library detection.
$libraries['example_missing'] = [ $libraries['example_missing'] = [
'name' => 'Example missing', 'name' => 'Example missing',
'library path' => drupal_get_path('module', 'libraries') . '/tests/missing', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/missing',
]; ];
$libraries['example_undetected_version'] = [ $libraries['example_undetected_version'] = [
'name' => 'Example undetected version', 'name' => 'Example undetected version',
'library path' => drupal_get_path('module', 'libraries') . '/tests', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests',
'version callback' => '_libraries_test_return_version', 'version callback' => '_libraries_test_return_version',
'version arguments' => [FALSE], 'version arguments' => [FALSE],
]; ];
$libraries['example_unsupported_version'] = [ $libraries['example_unsupported_version'] = [
'name' => 'Example unsupported version', 'name' => 'Example unsupported version',
'library path' => drupal_get_path('module', 'libraries') . '/tests', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests',
'version callback' => '_libraries_test_return_version', 'version callback' => '_libraries_test_return_version',
'version arguments' => ['1'], 'version arguments' => ['1'],
'versions' => [ 'versions' => [
...@@ -35,7 +35,7 @@ function libraries_test_libraries_info() { ...@@ -35,7 +35,7 @@ function libraries_test_libraries_info() {
$libraries['example_supported_version'] = [ $libraries['example_supported_version'] = [
'name' => 'Example supported version', 'name' => 'Example supported version',
'library path' => drupal_get_path('module', 'libraries') . '/tests', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests',
'version callback' => '_libraries_test_return_version', 'version callback' => '_libraries_test_return_version',
'version arguments' => ['1'], 'version arguments' => ['1'],
'versions' => [ 'versions' => [
...@@ -46,7 +46,7 @@ function libraries_test_libraries_info() { ...@@ -46,7 +46,7 @@ function libraries_test_libraries_info() {
// Test the default version callback. // Test the default version callback.
$libraries['example_default_version_callback'] = [ $libraries['example_default_version_callback'] = [
'name' => 'Example default version callback', 'name' => 'Example default version callback',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version arguments' => [ 'version arguments' => [
'file' => 'README.txt', 'file' => 'README.txt',
// Version 1 // Version 1
...@@ -58,7 +58,7 @@ function libraries_test_libraries_info() { ...@@ -58,7 +58,7 @@ function libraries_test_libraries_info() {
// Test a multiple-parameter version callback. // Test a multiple-parameter version callback.
$libraries['example_multiple_parameter_version_callback'] = [ $libraries['example_multiple_parameter_version_callback'] = [
'name' => 'Example multiple parameter version callback', 'name' => 'Example multiple parameter version callback',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
// Version 1 // Version 1
'version callback' => '_libraries_test_get_version', 'version callback' => '_libraries_test_get_version',
'version arguments' => ['README.txt', '/Version (\d+)/', 5], 'version arguments' => ['README.txt', '/Version (\d+)/', 5],
...@@ -67,7 +67,7 @@ function libraries_test_libraries_info() { ...@@ -67,7 +67,7 @@ function libraries_test_libraries_info() {
// Test a top-level files property. // Test a top-level files property.
$libraries['example_files'] = [ $libraries['example_files'] = [
'name' => 'Example files', 'name' => 'Example files',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'files' => [ 'files' => [
'js' => ['example_1.js'], 'js' => ['example_1.js'],
...@@ -81,7 +81,7 @@ function libraries_test_libraries_info() { ...@@ -81,7 +81,7 @@ function libraries_test_libraries_info() {
// these files should be automatically loaded when the library is loaded. // these files should be automatically loaded when the library is loaded.
$libraries['example_integration_files'] = [ $libraries['example_integration_files'] = [
'name' => 'Example integration files', 'name' => 'Example integration files',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'integration files' => [ 'integration files' => [
'libraries_test' => [ 'libraries_test' => [
...@@ -95,7 +95,7 @@ function libraries_test_libraries_info() { ...@@ -95,7 +95,7 @@ function libraries_test_libraries_info() {
// Test version overloading. // Test version overloading.
$libraries['example_versions'] = [ $libraries['example_versions'] = [
'name' => 'Example versions', 'name' => 'Example versions',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '2', 'version' => '2',
'versions' => [ 'versions' => [
'1' => [ '1' => [
...@@ -118,7 +118,7 @@ function libraries_test_libraries_info() { ...@@ -118,7 +118,7 @@ function libraries_test_libraries_info() {
// Test variant detection. // Test variant detection.
$libraries['example_variant_missing'] = [ $libraries['example_variant_missing'] = [
'name' => 'Example variant missing', 'name' => 'Example variant missing',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'variants' => [ 'variants' => [
'example_variant' => [ 'example_variant' => [
...@@ -135,7 +135,7 @@ function libraries_test_libraries_info() { ...@@ -135,7 +135,7 @@ function libraries_test_libraries_info() {
$libraries['example_variant'] = [ $libraries['example_variant'] = [
'name' => 'Example variant', 'name' => 'Example variant',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'variants' => [ 'variants' => [
'example_variant' => [ 'example_variant' => [
...@@ -153,7 +153,7 @@ function libraries_test_libraries_info() { ...@@ -153,7 +153,7 @@ function libraries_test_libraries_info() {
// Test correct behaviour with multiple versions and multiple variants. // Test correct behaviour with multiple versions and multiple variants.
$libraries['example_versions_and_variants'] = [ $libraries['example_versions_and_variants'] = [
'name' => 'Example versions and variants', 'name' => 'Example versions and variants',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '2', 'version' => '2',
'versions' => [ 'versions' => [
'1' => [ '1' => [
...@@ -209,27 +209,27 @@ function libraries_test_libraries_info() { ...@@ -209,27 +209,27 @@ function libraries_test_libraries_info() {
// This library acts as a dependency for the libraries below. // This library acts as a dependency for the libraries below.
$libraries['example_dependency'] = [ $libraries['example_dependency'] = [
'name' => 'Example dependency', 'name' => 'Example dependency',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1.1', 'version' => '1.1',
'files' => ['js' => ['example_1.js']], 'files' => ['js' => ['example_1.js']],
]; ];
$libraries['example_dependency_missing'] = [ $libraries['example_dependency_missing'] = [
'name' => 'Example dependency missing', 'name' => 'Example dependency missing',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'dependencies' => ['example_missing'], 'dependencies' => ['example_missing'],
'files' => ['js' => ['example_1.js']], 'files' => ['js' => ['example_1.js']],
]; ];
$libraries['example_dependency_incompatible'] = [ $libraries['example_dependency_incompatible'] = [
'name' => 'Example dependency incompatible', 'name' => 'Example dependency incompatible',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'dependencies' => ['example_dependency (>1.1)'], 'dependencies' => ['example_dependency (>1.1)'],
'files' => ['js' => ['example_1.js']], 'files' => ['js' => ['example_1.js']],
]; ];
$libraries['example_dependency_compatible'] = [ $libraries['example_dependency_compatible'] = [
'name' => 'Example dependency compatible', 'name' => 'Example dependency compatible',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'dependencies' => ['example_dependency (>=1.1)'], 'dependencies' => ['example_dependency (>=1.1)'],
'files' => ['js' => ['example_1.js']], 'files' => ['js' => ['example_1.js']],
...@@ -238,7 +238,7 @@ function libraries_test_libraries_info() { ...@@ -238,7 +238,7 @@ function libraries_test_libraries_info() {
// Test the applying of callbacks. // Test the applying of callbacks.
$libraries['example_callback'] = [ $libraries['example_callback'] = [
'name' => 'Example callback', 'name' => 'Example callback',
'library path' => drupal_get_path('module', 'libraries') . '/tests/example', 'library path' => \Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example',
'version' => '1', 'version' => '1',
'versions' => [ 'versions' => [
'1' => [ '1' => [
...@@ -292,7 +292,7 @@ function libraries_test_libraries_info() { ...@@ -292,7 +292,7 @@ function libraries_test_libraries_info() {
* Implements hook_libraries_info_file_paths() * Implements hook_libraries_info_file_paths()
*/ */
function libraries_test_libraries_info_file_paths() { function libraries_test_libraries_info_file_paths() {
return [drupal_get_path('module', 'libraries') . '/tests/example']; return [\Drupal::service('extension.list.module')->getPath('libraries') . '/tests/example'];
} }
/** /**
......
...@@ -39,12 +39,12 @@ class DefinitionDiscoveryFactoryTest extends BrowserTestBase { ...@@ -39,12 +39,12 @@ class DefinitionDiscoveryFactoryTest extends BrowserTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static $modules = ['libraries']; protected static $modules = ['libraries'];
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setUp(): void {
parent::setUp(); parent::setUp();
/** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */ /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
...@@ -115,9 +115,9 @@ class DefinitionDiscoveryFactoryTest extends BrowserTestBase { ...@@ -115,9 +115,9 @@ class DefinitionDiscoveryFactoryTest extends BrowserTestBase {
/** @var \Drupal\libraries\ExternalLibrary\Definition\DefinitionDiscoveryInterface $discovery */ /** @var \Drupal\libraries\ExternalLibrary\Definition\DefinitionDiscoveryInterface $discovery */
$discovery = $this->container->get($discovery_service_id); $discovery = $this->container->get($discovery_service_id);
$definition_file = "$definitions_directory/$library_id.json"; $definition_file = "$definitions_directory/$library_id.json";
$this->assertFileNotExists($definition_file); $this->assertFileDoesNotExist($definition_file);
$this->assertTrue($discovery->hasDefinition($library_id)); $this->assertTrue($discovery->hasDefinition($library_id));
$this->assertFileNotExists($definition_file); $this->assertFileDoesNotExist($definition_file);
$this->assertEquals($discovery->getDefinition($library_id), $expected_definition); $this->assertEquals($discovery->getDefinition($library_id), $expected_definition);
$this->assertFileExists($definition_file); $this->assertFileExists($definition_file);
} }
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ abstract class AssetLibraryTestBase extends LibraryTypeKernelTestBase { ...@@ -16,7 +16,7 @@ abstract class AssetLibraryTestBase extends LibraryTypeKernelTestBase {
* *
* @see \Drupal\libraries\ExternalLibrary\LibraryManager::getRequiredLibraryIds() * @see \Drupal\libraries\ExternalLibrary\LibraryManager::getRequiredLibraryIds()
*/ */
public static $modules = ['system']; protected static $modules = ['system'];
/** /**
* The Drupal core library discovery. * The Drupal core library discovery.
...@@ -28,7 +28,7 @@ abstract class AssetLibraryTestBase extends LibraryTypeKernelTestBase { ...@@ -28,7 +28,7 @@ abstract class AssetLibraryTestBase extends LibraryTypeKernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->coreLibraryDiscovery = $this->container->get('library.discovery'); $this->coreLibraryDiscovery = $this->container->get('library.discovery');
} }
......
...@@ -15,7 +15,7 @@ class GlobalLocatorTest extends LibraryTypeKernelTestBase { ...@@ -15,7 +15,7 @@ class GlobalLocatorTest extends LibraryTypeKernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setUp(): void {
parent::setUp(); parent::setUp();
// Assign our test stream (which points to the test php lib) to the asset // Assign our test stream (which points to the test php lib) to the asset
// scheme. This gives us a scheme to work with in the test that is not // scheme. This gives us a scheme to work with in the test that is not
......
...@@ -15,7 +15,7 @@ class PhpFileLibraryTest extends LibraryTypeKernelTestBase { ...@@ -15,7 +15,7 @@ class PhpFileLibraryTest extends LibraryTypeKernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->container->set('stream_wrapper.php_file_libraries', new TestLibraryFilesStream( $this->container->set('stream_wrapper.php_file_libraries', new TestLibraryFilesStream(
......
...@@ -14,7 +14,7 @@ class LibrariesUnitTest extends KernelTestBase { ...@@ -14,7 +14,7 @@ class LibrariesUnitTest extends KernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static $modules = ['libraries']; protected static $modules = ['libraries'];
/** /**
* Tests libraries_get_path(). * Tests libraries_get_path().
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Tests\libraries\Kernel; namespace Drupal\Tests\libraries\Kernel;
use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\KernelTests\KernelTestBase; use Drupal\KernelTests\KernelTestBase;
use Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException; use Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException;
...@@ -14,6 +15,7 @@ use Drupal\libraries\ExternalLibrary\Type\LibraryTypeInterface; ...@@ -14,6 +15,7 @@ use Drupal\libraries\ExternalLibrary\Type\LibraryTypeInterface;
*/ */
abstract class LibraryTypeKernelTestBase extends KernelTestBase { abstract class LibraryTypeKernelTestBase extends KernelTestBase {
use ProphecyTrait;
/** /**
* The external library manager. * The external library manager.
* *
...@@ -38,7 +40,7 @@ abstract class LibraryTypeKernelTestBase extends KernelTestBase { ...@@ -38,7 +40,7 @@ abstract class LibraryTypeKernelTestBase extends KernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static $modules = ['libraries', 'libraries_test']; protected static $modules = ['libraries', 'libraries_test'];
/** /**
* Gets the ID of the library type that is being tested. * Gets the ID of the library type that is being tested.
...@@ -50,7 +52,7 @@ abstract class LibraryTypeKernelTestBase extends KernelTestBase { ...@@ -50,7 +52,7 @@ abstract class LibraryTypeKernelTestBase extends KernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setUp(): void {
parent::setUp(); parent::setUp();
/** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Tests\libraries\Unit\Plugin\libraries\VersionDetector; namespace Drupal\Tests\libraries\Unit\Plugin\libraries\VersionDetector;
use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface; use Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface;
use Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface; use Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface;
use Drupal\libraries\Plugin\libraries\VersionDetector\LinePatternDetector; use Drupal\libraries\Plugin\libraries\VersionDetector\LinePatternDetector;
...@@ -18,6 +19,7 @@ use org\bovigo\vfs\vfsStream; ...@@ -18,6 +19,7 @@ use org\bovigo\vfs\vfsStream;
*/ */
class LinePatternDetectorTest extends UnitTestCase { class LinePatternDetectorTest extends UnitTestCase {
use ProphecyTrait;
protected $libraryId = 'test_library'; protected $libraryId = 'test_library';
/** /**
......
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