Commit d9edc3a2 authored by catch's avatar catch

Issue #2314347 by alexpott: Fixed Remove config.storage dependency from ConfigEntityStorage.

parent 6948f38d
......@@ -88,18 +88,15 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
* The entity type definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
* @param \Drupal\Core\Config\StorageInterface $config_storage
* The config storage service.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service, LanguageManagerInterface $language_manager) {
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager) {
parent::__construct($entity_type);
$this->configFactory = $config_factory;
$this->configStorage = $config_storage;
$this->uuidService = $uuid_service;
$this->languageManager = $language_manager;
}
......@@ -111,7 +108,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
return new static(
$entity_type,
$container->get('config.factory'),
$container->get('config.storage'),
$container->get('uuid'),
$container->get('language_manager')
);
......@@ -159,7 +155,7 @@ protected function doLoadMultiple(array $ids = NULL) {
// Get the names of the configuration entities we are going to load.
if ($ids === NULL) {
$names = $this->configStorage->listAll($prefix);
$names = $this->configFactory->listAll($prefix);
}
else {
$names = array();
......
......@@ -58,8 +58,6 @@ class FieldInstanceConfigStorage extends ConfigEntityStorage {
* The entity type definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
* @param \Drupal\Core\Config\StorageInterface $config_storage
* The config storage service.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
......@@ -71,8 +69,8 @@ class FieldInstanceConfigStorage extends ConfigEntityStorage {
* @param \Drupal\Component\Plugin\PluginManagerInterface\FieldTypePluginManagerInterface
* The field type plugin manager.
*/
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager, StateInterface $state, FieldTypePluginManagerInterface $field_type_manager) {
parent::__construct($entity_type, $config_factory, $config_storage, $uuid_service, $language_manager);
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager, StateInterface $state, FieldTypePluginManagerInterface $field_type_manager) {
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager);
$this->entityManager = $entity_manager;
$this->state = $state;
$this->fieldTypeManager = $field_type_manager;
......@@ -85,7 +83,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
return new static(
$entity_type,
$container->get('config.factory'),
$container->get('config.storage'),
$container->get('uuid'),
$container->get('language_manager'),
$container->get('entity.manager'),
......
......@@ -60,8 +60,6 @@ class FieldStorageConfigStorage extends ConfigEntityStorage {
* The entity type definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
* @param \Drupal\Core\Config\StorageInterface $config_storage
* The config storage service.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
......@@ -75,8 +73,8 @@ class FieldStorageConfigStorage extends ConfigEntityStorage {
* @param \Drupal\Component\Plugin\PluginManagerInterface\FieldTypePluginManagerInterface
* The field type plugin manager.
*/
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager, ModuleHandler $module_handler, StateInterface $state, FieldTypePluginManagerInterface $field_type_manager) {
parent::__construct($entity_type, $config_factory, $config_storage, $uuid_service, $language_manager);
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager, ModuleHandler $module_handler, StateInterface $state, FieldTypePluginManagerInterface $field_type_manager) {
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager);
$this->entityManager = $entity_manager;
$this->moduleHandler = $module_handler;
$this->state = $state;
......@@ -90,7 +88,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
return new static(
$entity_type,
$container->get('config.factory'),
$container->get('config.storage'),
$container->get('uuid'),
$container->get('language_manager'),
$container->get('entity.manager'),
......
......@@ -45,8 +45,8 @@ class ShortcutSetStorage extends ConfigEntityStorage implements ShortcutSetStora
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) {
parent::__construct($entity_info, $config_factory, $config_storage, $uuid_service, $language_manager);
public function __construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) {
parent::__construct($entity_info, $config_factory, $uuid_service, $language_manager);
$this->moduleHandler = $module_handler;
}
......@@ -58,7 +58,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
return new static(
$entity_info,
$container->get('config.factory'),
$container->get('config.storage'),
$container->get('uuid'),
$container->get('module_handler'),
$container->get('language_manager')
......
......@@ -68,13 +68,6 @@ class ConfigEntityStorageTest extends UnitTestCase {
*/
protected $configFactory;
/**
* The config storage service.
*
* @var \Drupal\Core\Config\StorageInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $configStorage;
/**
* The entity query.
*
......@@ -139,14 +132,12 @@ protected function setUp() {
->method('getDefaultLanguage')
->will($this->returnValue(new Language(array('langcode' => 'en'))));
$this->configStorage = $this->getConfigStorageStub(array());
$this->configFactory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
$this->entityQuery = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
$this->entityStorage = $this->getMockBuilder('Drupal\Core\Config\Entity\ConfigEntityStorage')
->setConstructorArgs(array($this->entityType, $this->configFactory, $this->configStorage, $this->uuidService, $this->languageManager))
->setConstructorArgs(array($this->entityType, $this->configFactory, $this->uuidService, $this->languageManager))
->setMethods(array('getQuery'))
->getMock();
$this->entityStorage->expects($this->any())
......@@ -641,9 +632,13 @@ public function testLoadMultipleAll() {
array('id', 'bar'),
)));
$this->configFactory->expects($this->once())
->method('listAll')
->with('the_config_prefix.')
->will($this->returnValue(array('the_config_prefix.foo' , 'the_config_prefix.bar')));
$this->configFactory->expects($this->once())
->method('loadMultiple')
->with(array())
->with(array('the_config_prefix.foo' , 'the_config_prefix.bar'))
->will($this->returnValue(array($foo_config_object, $bar_config_object)));
$this->moduleHandler->expects($this->exactly(2))
->method('getImplementations')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment