Revert "Issue #3419914 by Spokje, longwave, andypost, smustgrave: Remove UpdateHookRegistryFactory and UpdateRegistryFactory services"
This reverts commit e5c3c870e3
.
merge-requests/4324/merge
parent
589b8fe870
commit
f41e428e8a
|
@ -1788,19 +1788,17 @@ services:
|
||||||
Drupal\Component\Utility\EmailValidatorInterface: '@email.validator'
|
Drupal\Component\Utility\EmailValidatorInterface: '@email.validator'
|
||||||
update.update_hook_registry:
|
update.update_hook_registry:
|
||||||
class: Drupal\Core\Update\UpdateHookRegistry
|
class: Drupal\Core\Update\UpdateHookRegistry
|
||||||
arguments: ['%container.modules%', '@keyvalue']
|
factory: ['@update.update_hook_registry_factory', create]
|
||||||
Drupal\Core\Update\UpdateHookRegistry: '@update.update_hook_registry'
|
Drupal\Core\Update\UpdateHookRegistry: '@update.update_hook_registry'
|
||||||
update.update_hook_registry_factory:
|
update.update_hook_registry_factory:
|
||||||
class: Drupal\Core\Update\UpdateHookRegistryFactory
|
class: Drupal\Core\Update\UpdateHookRegistryFactory
|
||||||
parent: container.trait
|
parent: container.trait
|
||||||
deprecated: The "%service_id%" service is deprecated. You should use the 'update.update_hook_registry' service instead. See https://www.drupal.org/node/3423659
|
|
||||||
update.post_update_registry:
|
update.post_update_registry:
|
||||||
class: Drupal\Core\Update\UpdateRegistry
|
class: Drupal\Core\Update\UpdateRegistry
|
||||||
arguments: [ '%app.root%', '%site.path%', '%container.modules%', '@keyvalue', '@theme_handler' ]
|
factory: ['@update.post_update_registry_factory', create]
|
||||||
update.post_update_registry_factory:
|
update.post_update_registry_factory:
|
||||||
class: Drupal\Core\Update\UpdateRegistryFactory
|
class: Drupal\Core\Update\UpdateRegistryFactory
|
||||||
parent: container.trait
|
parent: container.trait
|
||||||
deprecated: The "%service_id%" service is deprecated. You should use the 'update.post_update_registry' service instead. See https://www.drupal.org/node/3423659
|
|
||||||
uuid:
|
uuid:
|
||||||
class: Drupal\Component\Uuid\Php
|
class: Drupal\Component\Uuid\Php
|
||||||
Drupal\Component\Uuid\UuidInterface: '@uuid'
|
Drupal\Component\Uuid\UuidInterface: '@uuid'
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Drupal\Core\Update;
|
namespace Drupal\Core\Update;
|
||||||
|
|
||||||
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
|
|
||||||
use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
|
use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,24 +50,16 @@ class UpdateHookRegistry {
|
||||||
protected $allAvailableSchemaVersions = [];
|
protected $allAvailableSchemaVersions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new UpdateHookRegistry.
|
* Constructs a new UpdateRegistry.
|
||||||
*
|
*
|
||||||
* @param array $module_list
|
* @param string[] $enabled_modules
|
||||||
* An associative array whose keys are the names of installed modules.
|
* A list of enabled modules.
|
||||||
* @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface|\Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_factory
|
* @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value
|
||||||
* The key value factory.
|
* The key value store.
|
||||||
*/
|
*/
|
||||||
public function __construct(array $module_list, KeyValueStoreInterface|KeyValueFactoryInterface $key_value_factory) {
|
public function __construct(array $enabled_modules, KeyValueStoreInterface $key_value) {
|
||||||
if ($module_list !== [] && array_is_list($module_list)) {
|
$this->enabledModules = $enabled_modules;
|
||||||
@trigger_error('Calling ' . __METHOD__ . '() with the $enabled_modules argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use an associative array whose keys are the names of installed modules instead. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
|
$this->keyValue = $key_value;
|
||||||
$module_list = \Drupal::service('module_handler')->getModuleList();
|
|
||||||
}
|
|
||||||
if ($key_value_factory instanceof KeyValueStoreInterface) {
|
|
||||||
@trigger_error('Calling ' . __METHOD__ . '() with the $key_value_factory argument as a KeyValueStoreInterface instead of a KeyValueFactoryInterface is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
|
|
||||||
$key_value_factory = \Drupal::service('keyvalue');
|
|
||||||
}
|
|
||||||
$this->enabledModules = array_keys($module_list);
|
|
||||||
$this->keyValue = $key_value_factory->get('system.schema');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,22 +7,11 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service factory for the versioning update registry.
|
* Service factory for the versioning update registry.
|
||||||
*
|
|
||||||
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
|
|
||||||
* \Drupal\Core\Update\UpdateHookRegistry instead.
|
|
||||||
*
|
|
||||||
* @see https://www.drupal.org/node/3423659
|
|
||||||
*/
|
*/
|
||||||
class UpdateHookRegistryFactory implements ContainerAwareInterface {
|
class UpdateHookRegistryFactory implements ContainerAwareInterface {
|
||||||
|
|
||||||
use ContainerAwareTrait;
|
use ContainerAwareTrait;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new UpdateHookRegistry instance.
|
* Creates a new UpdateHookRegistry instance.
|
||||||
*
|
*
|
||||||
|
@ -30,10 +19,9 @@ class UpdateHookRegistryFactory implements ContainerAwareInterface {
|
||||||
* The update registry instance.
|
* The update registry instance.
|
||||||
*/
|
*/
|
||||||
public function create() {
|
public function create() {
|
||||||
@trigger_error(__NAMESPACE__ . '\UpdateHookRegistryFactory is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Update\UpdateHookRegistry instead. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
|
|
||||||
return new UpdateHookRegistry(
|
return new UpdateHookRegistry(
|
||||||
$this->container->get('module_handler')->getModuleList(),
|
array_keys($this->container->get('module_handler')->getModuleList()),
|
||||||
$this->container->get('keyvalue')
|
$this->container->get('keyvalue')->get('system.schema')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ use Drupal\Core\Config\ConfigCrudEvent;
|
||||||
use Drupal\Core\Config\ConfigEvents;
|
use Drupal\Core\Config\ConfigEvents;
|
||||||
use Drupal\Core\Extension\Extension;
|
use Drupal\Core\Extension\Extension;
|
||||||
use Drupal\Core\Extension\ExtensionDiscovery;
|
use Drupal\Core\Extension\ExtensionDiscovery;
|
||||||
use Drupal\Core\Extension\ThemeHandlerInterface;
|
use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
|
||||||
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
// cspell:ignore updatetype
|
// cspell:ignore updatetype
|
||||||
|
@ -56,6 +55,13 @@ class UpdateRegistry implements EventSubscriberInterface {
|
||||||
*/
|
*/
|
||||||
protected $keyValue;
|
protected $keyValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we respect update functions in tests.
|
||||||
|
*
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
protected $includeTests = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The site path.
|
* The site path.
|
||||||
*
|
*
|
||||||
|
@ -80,26 +86,19 @@ class UpdateRegistry implements EventSubscriberInterface {
|
||||||
* The app root.
|
* The app root.
|
||||||
* @param string $site_path
|
* @param string $site_path
|
||||||
* The site path.
|
* The site path.
|
||||||
* @param array $module_list
|
* @param string[] $enabled_extensions
|
||||||
* An associative array whose keys are the names of installed modules.
|
* A list of enabled extensions.
|
||||||
* @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_factory
|
* @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value
|
||||||
* The key value factory.
|
* The key value store.
|
||||||
* @param \Drupal\Core\Extension\ThemeHandlerInterface|bool|null $theme_handler
|
* @param bool|null $include_tests
|
||||||
* The theme handler.
|
* (optional) A flag whether to include tests in the scanning of extensions.
|
||||||
*/
|
*/
|
||||||
public function __construct($root, $site_path, $module_list, KeyValueFactoryInterface $key_value_factory, ThemeHandlerInterface|bool $theme_handler = NULL) {
|
public function __construct($root, $site_path, array $enabled_extensions, KeyValueStoreInterface $key_value, $include_tests = NULL) {
|
||||||
$this->root = $root;
|
$this->root = $root;
|
||||||
$this->sitePath = $site_path;
|
$this->sitePath = $site_path;
|
||||||
if ($module_list !== [] && array_is_list($module_list)) {
|
$this->enabledExtensions = $enabled_extensions;
|
||||||
@trigger_error('Calling ' . __METHOD__ . '() with the $enabled_extensions argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use an associative array whose keys are the names of installed modules instead. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
|
$this->keyValue = $key_value;
|
||||||
$module_list = \Drupal::service('module_handler')->getModuleList();
|
$this->includeTests = $include_tests;
|
||||||
}
|
|
||||||
if ($theme_handler === NULL || is_bool($theme_handler)) {
|
|
||||||
@trigger_error('Calling ' . __METHOD__ . '() with the $include_tests argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
|
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
|
||||||
}
|
|
||||||
$this->enabledExtensions = array_merge(array_keys($module_list), array_keys($theme_handler->listInfo()));
|
|
||||||
$this->keyValue = $key_value_factory->get('post_update');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,11 +7,6 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service factory for the update registry.
|
* Service factory for the update registry.
|
||||||
*
|
|
||||||
* @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
|
|
||||||
* \Drupal\Core\Update\UpdateRegistry instead.
|
|
||||||
*
|
|
||||||
* @see https://www.drupal.org/node/3423659
|
|
||||||
*/
|
*/
|
||||||
class UpdateRegistryFactory implements ContainerAwareInterface {
|
class UpdateRegistryFactory implements ContainerAwareInterface {
|
||||||
|
|
||||||
|
@ -24,14 +19,8 @@ class UpdateRegistryFactory implements ContainerAwareInterface {
|
||||||
* The update registry instance.
|
* The update registry instance.
|
||||||
*/
|
*/
|
||||||
public function create() {
|
public function create() {
|
||||||
@trigger_error(__NAMESPACE__ . '\UpdateHookRegistryFactory is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Update\UpdateRegistry instead. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
|
$extensions = array_merge(array_keys($this->container->get('module_handler')->getModuleList()), array_keys($this->container->get('theme_handler')->listInfo()));
|
||||||
return new UpdateRegistry(
|
return new UpdateRegistry($this->container->getParameter('app.root'), $this->container->getParameter('site.path'), $extensions, $this->container->get('keyvalue')->get('post_update'));
|
||||||
$this->container->getParameter('app.root'),
|
|
||||||
$this->container->getParameter('site.path'),
|
|
||||||
$this->container->get('module_handler')->getModuleList(),
|
|
||||||
$this->container->get('keyvalue'),
|
|
||||||
$this->container->get('theme_handler')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,11 +619,43 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php
|
path: lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: """
|
||||||
|
#^Class Drupal\\\\Core\\\\Update\\\\UpdateHookRegistryFactory implements deprecated interface Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\:
|
||||||
|
since Symfony 6\\.4, use dependency injection instead$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: lib/Drupal/Core/Update/UpdateHookRegistryFactory.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: """
|
||||||
|
#^Usage of deprecated trait Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareTrait in class Drupal\\\\Core\\\\Update\\\\UpdateHookRegistryFactory\\:
|
||||||
|
since Symfony 6\\.4, use dependency injection instead$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: lib/Drupal/Core/Update/UpdateHookRegistryFactory.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Drupal\\\\Core\\\\Update\\\\UpdateKernel\\:\\:discoverServiceProviders\\(\\) should return array but return statement is missing\\.$#"
|
message: "#^Method Drupal\\\\Core\\\\Update\\\\UpdateKernel\\:\\:discoverServiceProviders\\(\\) should return array but return statement is missing\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: lib/Drupal/Core/Update/UpdateKernel.php
|
path: lib/Drupal/Core/Update/UpdateKernel.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: """
|
||||||
|
#^Class Drupal\\\\Core\\\\Update\\\\UpdateRegistryFactory implements deprecated interface Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\:
|
||||||
|
since Symfony 6\\.4, use dependency injection instead$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: lib/Drupal/Core/Update/UpdateRegistryFactory.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: """
|
||||||
|
#^Usage of deprecated trait Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareTrait in class Drupal\\\\Core\\\\Update\\\\UpdateRegistryFactory\\:
|
||||||
|
since Symfony 6\\.4, use dependency injection instead$#
|
||||||
|
"""
|
||||||
|
count: 1
|
||||||
|
path: lib/Drupal/Core/Update/UpdateRegistryFactory.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Drupal\\\\Core\\\\Updater\\\\Module\\:\\:postUpdateTasks\\(\\) should return array but return statement is missing\\.$#"
|
message: "#^Method Drupal\\\\Core\\\\Updater\\\\Module\\:\\:postUpdateTasks\\(\\) should return array but return statement is missing\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
|
@ -93,7 +93,7 @@ class UpdateHookRegistryTest extends UnitTestCase {
|
||||||
public function testGetVersions() {
|
public function testGetVersions() {
|
||||||
$module_name = 'drupal\tests\core\update\under_test';
|
$module_name = 'drupal\tests\core\update\under_test';
|
||||||
|
|
||||||
$update_registry = new UpdateHookRegistry([], $this->keyValueFactory);
|
$update_registry = new UpdateHookRegistry([], $this->keyValueStore);
|
||||||
|
|
||||||
// Only under_test_update_X - passes through the filter.
|
// Only under_test_update_X - passes through the filter.
|
||||||
$expected = [1, 20, 3000];
|
$expected = [1, 20, 3000];
|
||||||
|
@ -136,7 +136,7 @@ class UpdateHookRegistryTest extends UnitTestCase {
|
||||||
$versions[$key] = $value;
|
$versions[$key] = $value;
|
||||||
});
|
});
|
||||||
|
|
||||||
$update_registry = new UpdateHookRegistry([], $this->keyValueFactory);
|
$update_registry = new UpdateHookRegistry([], $this->keyValueStore);
|
||||||
|
|
||||||
$this->assertSame(3000, $update_registry->getInstalledVersion('module3'));
|
$this->assertSame(3000, $update_registry->getInstalledVersion('module3'));
|
||||||
$update_registry->setInstalledVersion('module3', 3001);
|
$update_registry->setInstalledVersion('module3', 3001);
|
||||||
|
|
|
@ -4,8 +4,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Drupal\Tests\Core\Update;
|
namespace Drupal\Tests\Core\Update;
|
||||||
|
|
||||||
use Drupal\Core\Extension\ThemeHandlerInterface;
|
|
||||||
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
|
|
||||||
use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
|
use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
|
||||||
use Drupal\Core\Site\Settings;
|
use Drupal\Core\Site\Settings;
|
||||||
use Drupal\Core\Update\RemovedPostUpdateNameException;
|
use Drupal\Core\Update\RemovedPostUpdateNameException;
|
||||||
|
@ -190,33 +188,11 @@ EOS;
|
||||||
$key_value->get('existing_updates', [])->willReturn([]);
|
$key_value->get('existing_updates', [])->willReturn([]);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
'module_a_post_update_a',
|
'module_a_post_update_a',
|
||||||
|
@ -237,27 +213,14 @@ EOS;
|
||||||
$key_value->get('existing_updates', [])->willReturn([]);
|
$key_value->get('existing_updates', [])->willReturn([]);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
// Preload modules to ensure that ::getAvailableUpdateFunctions filters out
|
// Preload modules to ensure that ::getAvailableUpdateFunctions filters out
|
||||||
// not enabled modules.
|
// not enabled modules.
|
||||||
include_once 'vfs://drupal/sites/default/modules/module_a/module_a.post_update.php';
|
include_once 'vfs://drupal/sites/default/modules/module_a/module_a.post_update.php';
|
||||||
include_once 'vfs://drupal/sites/default/modules/module_b/module_b.post_update.php';
|
include_once 'vfs://drupal/sites/default/modules/module_b/module_b.post_update.php';
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
], $key_value, FALSE);
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
'module_a_post_update_a',
|
'module_a_post_update_a',
|
||||||
|
@ -272,40 +235,14 @@ EOS;
|
||||||
$this->setupBasicExtensions();
|
$this->setupBasicExtensions();
|
||||||
|
|
||||||
$key_value = $this->prophesize(KeyValueStoreInterface::class);
|
$key_value = $this->prophesize(KeyValueStoreInterface::class);
|
||||||
$key_value->get('existing_updates', [])->willReturn([
|
$key_value->get('existing_updates', [])->willReturn(['module_a_post_update_a', 'theme_d_post_update_a', 'theme_d_post_update_b']);
|
||||||
'module_a_post_update_a',
|
|
||||||
'theme_d_post_update_a',
|
|
||||||
'theme_d_post_update_b',
|
|
||||||
]);
|
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$this->assertEquals(array_values([
|
$this->assertEquals(array_values([
|
||||||
'module_a_post_update_b',
|
'module_a_post_update_b',
|
||||||
|
@ -325,33 +262,11 @@ EOS;
|
||||||
$key_value->get('existing_updates', [])->willReturn([]);
|
$key_value->get('existing_updates', [])->willReturn([]);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$expected = [];
|
$expected = [];
|
||||||
$expected['module_a']['pending']['a'] = 'Module A update A.';
|
$expected['module_a']['pending']['a'] = 'Module A update A.';
|
||||||
|
@ -373,40 +288,14 @@ EOS;
|
||||||
$this->setupBasicExtensions();
|
$this->setupBasicExtensions();
|
||||||
|
|
||||||
$key_value = $this->prophesize(KeyValueStoreInterface::class);
|
$key_value = $this->prophesize(KeyValueStoreInterface::class);
|
||||||
$key_value->get('existing_updates', [])->willReturn([
|
$key_value->get('existing_updates', [])->willReturn(['module_a_post_update_a', 'theme_d_post_update_a', 'theme_d_post_update_b']);
|
||||||
'module_a_post_update_a',
|
|
||||||
'theme_d_post_update_a',
|
|
||||||
'theme_d_post_update_b',
|
|
||||||
]);
|
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$expected = [];
|
$expected = [];
|
||||||
$expected['module_a']['pending']['b'] = 'Module A update B.';
|
$expected['module_a']['pending']['b'] = 'Module A update B.';
|
||||||
|
@ -429,22 +318,9 @@ EOS;
|
||||||
$key_value->get('existing_updates', [])->willReturn(['module_a_post_update_a']);
|
$key_value->get('existing_updates', [])->willReturn(['module_a_post_update_a']);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_c' =>
|
'module_c',
|
||||||
[
|
], $key_value, FALSE);
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_c/module_c.info.yml',
|
|
||||||
'filename' => 'module_c.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$this->expectException(RemovedPostUpdateNameException::class);
|
$this->expectException(RemovedPostUpdateNameException::class);
|
||||||
$update_registry->getPendingUpdateInformation();
|
$update_registry->getPendingUpdateInformation();
|
||||||
|
@ -457,33 +333,11 @@ EOS;
|
||||||
$this->setupBasicExtensions();
|
$this->setupBasicExtensions();
|
||||||
$key_value = $this->prophesize(KeyValueStoreInterface::class)->reveal();
|
$key_value = $this->prophesize(KeyValueStoreInterface::class)->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
|
|
||||||
$this->assertEquals(['module_a_post_update_a', 'module_a_post_update_b'], array_values($update_registry->getUpdateFunctions('module_a')));
|
$this->assertEquals(['module_a_post_update_a', 'module_a_post_update_b'], array_values($update_registry->getUpdateFunctions('module_a')));
|
||||||
$this->assertEquals(['module_b_post_update_a'], array_values($update_registry->getUpdateFunctions('module_b')));
|
$this->assertEquals(['module_b_post_update_a'], array_values($update_registry->getUpdateFunctions('module_b')));
|
||||||
|
@ -504,33 +358,11 @@ EOS;
|
||||||
->shouldBeCalledTimes(1);
|
->shouldBeCalledTimes(1);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
$update_registry->registerInvokedUpdates(['module_a_post_update_a']);
|
$update_registry->registerInvokedUpdates(['module_a_post_update_a']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,33 +380,11 @@ EOS;
|
||||||
->shouldBeCalledTimes(1);
|
->shouldBeCalledTimes(1);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
$update_registry->registerInvokedUpdates(['module_a_post_update_a', 'module_a_post_update_b', 'theme_d_post_update_c']);
|
$update_registry->registerInvokedUpdates(['module_a_post_update_a', 'module_a_post_update_b', 'theme_d_post_update_c']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,28 +402,10 @@ EOS;
|
||||||
->shouldBeCalledTimes(1);
|
->shouldBeCalledTimes(1);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
], $key_value, FALSE);
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
$update_registry->registerInvokedUpdates(['module_a_post_update_a']);
|
$update_registry->registerInvokedUpdates(['module_a_post_update_a']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,33 +423,12 @@ EOS;
|
||||||
->shouldBeCalledTimes(1);
|
->shouldBeCalledTimes(1);
|
||||||
$key_value = $key_value->reveal();
|
$key_value = $key_value->reveal();
|
||||||
|
|
||||||
$key_value_factory = $this->prophesize(KeyValueFactoryInterface::class);
|
|
||||||
$key_value_factory->get('post_update')->willReturn($key_value);
|
|
||||||
$key_value_factory = $key_value_factory->reveal();
|
|
||||||
|
|
||||||
$theme_handler = $this->prophesize(ThemeHandlerInterface::class);
|
|
||||||
$theme_handler->listInfo()->willReturn([
|
|
||||||
'theme_d' => [
|
|
||||||
'type' => 'theme_d',
|
|
||||||
'pathname' => 'core/themes/theme_d/theme_d.info.yml',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$theme_handler = $theme_handler->reveal();
|
|
||||||
|
|
||||||
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
$update_registry = new UpdateRegistry('vfs://drupal', 'sites/default', [
|
||||||
'module_a' =>
|
'module_a',
|
||||||
[
|
'module_b',
|
||||||
'type' => 'module',
|
'theme_d',
|
||||||
'pathname' => 'core/modules/module_a/module_a.info.yml',
|
], $key_value, FALSE);
|
||||||
'filename' => 'module_a.module',
|
|
||||||
],
|
|
||||||
'module_b' =>
|
|
||||||
[
|
|
||||||
'type' => 'module',
|
|
||||||
'pathname' => 'core/modules/module_b/module_b.info.yml',
|
|
||||||
'filename' => 'module_b.module',
|
|
||||||
],
|
|
||||||
], $key_value_factory, $theme_handler);
|
|
||||||
$update_registry->filterOutInvokedUpdatesByExtension('module_a');
|
$update_registry->filterOutInvokedUpdatesByExtension('module_a');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue