Issue #2886622 by Berdir, martin107, Mile23, tim.plunkett, mikelutz, jonathan1055: Deprecate all EntityManager methods with E_USER_DEPRECATED

merge-requests/1119/head
Alex Pott 2019-05-30 12:36:55 +01:00
parent d397f60cf6
commit 408c540ccf
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
263 changed files with 601 additions and 604 deletions

View File

@ -108,7 +108,7 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition,
$container->get('token'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('logger.factory')->get('action'),
$container->get('plugin.manager.mail'),
$container->get('language_manager'),

View File

@ -24,7 +24,7 @@ class EntityViewController implements ContainerInjectionInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

View File

@ -19,8 +19,8 @@ use Drupal\Core\Entity\EntityFormModeInterface;
* display settings, or just replicate the settings of the 'default' form mode,
* thus reducing the amount of form display configurations to keep track of.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getAllFormModes()
* @see \Drupal\Core\Entity\EntityManagerInterface::getFormModes()
* @see \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getAllFormModes()
* @see \Drupal\Core\Entity\EntityDisplayRepositoryInterface::getFormModes()
*
* @ConfigEntityType(
* id = "entity_form_mode",

View File

@ -13,10 +13,11 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
* perform complex or long-running logic in response to the change. For
* example, a SQL-based storage handler may need to update the database schema.
*
* To support this, \Drupal\Core\Entity\EntityManagerInterface has methods to
* retrieve the last installed definitions as well as the definitions specified
* by the current codebase. It also has create/update/delete methods to bring
* the former up to date with the latter.
* To support this,
* \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface has methods
* to retrieve the last installed definitions as well as the definitions
* specified by the current codebase. It also has create/update/delete methods
* to bring the former up to date with the latter.
*
* However, it is not the responsibility of the entity manager to decide how to
* report the differences or when to apply each update. This interface is for

View File

@ -16,7 +16,7 @@ class EntityDeleteMultipleAccessCheck implements AccessInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

View File

@ -13,9 +13,6 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
* Deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. We cannot
* use the deprecated PHPDoc tag because this service class is still used in
* legacy code paths. Symfony would fail test cases with deprecation warnings.
*
* @todo Enforce the deprecation of each method once
* https://www.drupal.org/node/2578361 is in.
*/
class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
@ -52,6 +49,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
@trigger_error('EntityManagerInterface::getDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinition() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getDefinition($entity_type_id, $exception_on_invalid);
}
@ -65,6 +63,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function hasHandler($entity_type_id, $handler_type) {
@trigger_error('EntityManagerInterface::hasHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->hasHandler($entity_type_id, $handler_type);
}
@ -77,6 +76,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getStorage($entity_type_id) {
@trigger_error('EntityManagerInterface::getStorage() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getStorage() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getStorage($entity_type_id);
}
@ -90,6 +90,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getListBuilder($entity_type_id) {
@trigger_error('EntityManagerInterface::getListBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getListBuilder() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getListBuilder($entity_type_id);
}
@ -103,6 +104,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getFormObject($entity_type_id, $operation) {
@trigger_error('EntityManagerInterface::getFormObject() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getFormObject() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getFormObject($entity_type_id, $operation);
}
@ -116,6 +118,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getRouteProviders($entity_type_id) {
@trigger_error('EntityManagerInterface::getRouteProviders() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getRouteProviders() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getRouteProviders($entity_type_id);
}
@ -129,6 +132,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getViewBuilder($entity_type_id) {
@trigger_error('EntityManagerInterface::getViewBuilder() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getViewBuilder() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getViewBuilder($entity_type_id);
}
@ -142,6 +146,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getAccessControlHandler($entity_type_id) {
@trigger_error('EntityManagerInterface::getAccessControlHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getAccessControlHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type_id);
}
@ -154,6 +159,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getHandler($entity_type_id, $handler_type) {
@trigger_error('EntityManagerInterface::getHandler() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getHandler() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getHandler($entity_type_id, $handler_type);
}
@ -167,6 +173,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function createHandlerInstance($class, EntityTypeInterface $definition = NULL) {
@trigger_error('EntityManagerInterface::createHandlerInstance() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::createHandlerInstance() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->createHandlerInstance($class, $definition);
}
@ -807,6 +814,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function getDefinitions() {
@trigger_error('EntityManagerInterface::getDefinitions() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::getDefinitions() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->getDefinitions();
}
@ -820,6 +828,7 @@ class EntityManager implements EntityManagerInterface, ContainerAwareInterface {
* @see https://www.drupal.org/node/2549139
*/
public function hasDefinition($plugin_id) {
@trigger_error('EntityManagerInterface::hasDefinition() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManager::hasDefinition() instead. See https://www.drupal.org/node/2549139', E_USER_DEPRECATED);
return $this->container->get('entity_type.manager')->hasDefinition($plugin_id);
}

View File

@ -17,7 +17,7 @@ final class EntityTypeEvents {
* @Event
*
* @see \Drupal\Core\Entity\EntityTypeEvent
* @see \Drupal\Core\Entity\EntityManager::onEntityTypeCreate()
* @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeCreate()
* @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait
* @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeCreate()
*
@ -35,7 +35,7 @@ final class EntityTypeEvents {
* @Event
*
* @see \Drupal\Core\Entity\EntityTypeEvent
* @see \Drupal\Core\Entity\EntityManager::onEntityTypeUpdate()
* @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeUpdate()
* @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait
* @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeUpdate()
*
@ -53,7 +53,7 @@ final class EntityTypeEvents {
* @Event
*
* @see \Drupal\Core\Entity\EntityTypeEvent
* @see \Drupal\Core\Entity\EntityManager::onEntityTypeDelete()
* @see \Drupal\Core\Entity\EntityTypeListenerInterface::onEntityTypeDelete()
* @see \Drupal\Core\Entity\EntityTypeEventSubscriberTrait
* @see \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::onEntityTypeDelete()
*

View File

@ -49,7 +49,7 @@ interface FieldableEntityInterface extends EntityInterface {
* An array of base field definitions for the entity type, keyed by field
* name.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions()
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type);
@ -85,7 +85,7 @@ interface FieldableEntityInterface extends EntityInterface {
* @return \Drupal\Core\Field\FieldDefinitionInterface[]
* An array of bundle field definitions, keyed by field name.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\FieldableEntityInterface::baseFieldDefinitions()
*
* @todo WARNING: This method will be changed in
@ -121,7 +121,7 @@ interface FieldableEntityInterface extends EntityInterface {
* @return \Drupal\Core\Field\FieldDefinitionInterface[]
* An array of field definitions, keyed by field name.
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
*/
public function getFieldDefinitions();

View File

@ -51,7 +51,7 @@ class DefaultSelection extends SelectionPluginBase implements ContainerFactoryPl
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

View File

@ -33,7 +33,7 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

View File

@ -582,7 +582,7 @@ use Drupal\node\Entity\NodeType;
* @code
* $view_builder = \Drupal::entityTypeManager()->getViewBuilder('your_entity_type');
* // Or if you have a $container variable:
* $view_builder = $container->get('entity.manager')->getViewBuilder('your_entity_type');
* $view_builder = $container->get('entity_type.manager')->getViewBuilder('your_entity_type');
* @endcode
* Then, to build and render the entity:
* @code
@ -1940,7 +1940,7 @@ function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\Entit
*
* @see hook_entity_field_storage_info_alter()
* @see \Drupal\Core\Field\FieldStorageDefinitionInterface
* @see \Drupal\Core\Entity\EntityManagerInterface::getFieldStorageDefinitions()
* @see \Drupal\Core\Entity\EntityFieldManagerInterface::getFieldStorageDefinitions()
*/
function hook_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
if (\Drupal::entityTypeManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
@ -2176,7 +2176,7 @@ function hook_entity_extra_field_info() {
*
* @param array $info
* The array structure is identical to that of the return value of
* \Drupal\Core\Entity\EntityManagerInterface::getExtraFields().
* \Drupal\Core\Entity\EntityFieldManagerInterface::getExtraFields().
*
* @see hook_entity_extra_field_info()
*/

View File

@ -17,10 +17,10 @@ interface ModuleUninstallValidatorInterface {
* Example implementation:
* @code
* public function validate($module) {
* $entity_types = $this->entityManager->getDefinitions();
* $entity_types = $this->entityTypeManager->getDefinitions();
* $reasons = array();
* foreach ($entity_types as $entity_type) {
* if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) {
* if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityTypeManager->getStorage($entity_type->id())->hasData()) {
* $reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel()));
* }
* }

View File

@ -17,7 +17,7 @@ final class FieldStorageDefinitionEvents {
* @Event
*
* @see \Drupal\Core\Field\FieldStorageDefinitionEvent
* @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionCreate()
* @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionCreate
* @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
*
* @var string
@ -34,7 +34,7 @@ final class FieldStorageDefinitionEvents {
* @Event
*
* @see \Drupal\Core\Field\FieldStorageDefinitionEvent
* @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionUpdate()
* @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionUpdate()
* @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
*
* @var string
@ -51,7 +51,7 @@ final class FieldStorageDefinitionEvents {
* @Event
*
* @see \Drupal\Core\Field\FieldStorageDefinitionEvent
* @see \Drupal\Core\Entity\EntityManager::onFieldStorageDefinitionDelete()
* @see \Drupal\Core\Field\FieldStorageDefinitionListener::onFieldStorageDefinitionDelete()
* @see \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait
*
* @var string

View File

@ -82,7 +82,7 @@ class TimestampFormatter extends FormatterBase implements ContainerFactoryPlugin
$configuration['view_mode'],
$configuration['third_party_settings'],
$container->get('date.formatter'),
$container->get('entity.manager')->getStorage('date_format')
$container->get('entity_type.manager')->getStorage('date_format')
);
}

View File

@ -93,7 +93,7 @@ class SiteConfigureForm extends ConfigFormBase {
return new static(
$container->get('app.root'),
$container->get('site.path'),
$container->get('entity.manager')->getStorage('user'),
$container->get('entity_type.manager')->getStorage('user'),
$container->get('state'),
$container->get('module_installer'),
$container->get('country_manager')

View File

@ -42,7 +42,7 @@ abstract class ActionFormBase extends EntityForm {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('action')
$container->get('entity_type.manager')->getStorage('action')
);
}

View File

@ -27,7 +27,7 @@ class ActionListTest extends BrowserTestBase {
// Ensure the empty text appears on the action list page.
/** @var $storage \Drupal\Core\Entity\EntityStorageInterface */
$storage = $this->container->get('entity.manager')->getStorage('action');
$storage = $this->container->get('entity_type.manager')->getStorage('action');
$actions = $storage->loadMultiple();
$storage->delete($actions);
$this->drupalGet('/admin/config/system/actions');

View File

@ -49,7 +49,7 @@ class OpmlFeedAdd extends FormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('aggregator_feed'),
$container->get('entity_type.manager')->getStorage('aggregator_feed'),
$container->get('http_client')
);
}

View File

@ -50,7 +50,12 @@ class Iid extends NumericArgument {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager'));
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity_type.manager')
);
}
/**

View File

@ -69,7 +69,7 @@ class AggregatorAdminTest extends AggregatorTestBase {
// Check if the fields in the table match with what's expected.
$link = $this->xpath('//table/tbody/tr//td[1]/a');
$this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
$count = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->getItemCount($feed);
$td = $this->xpath('//table/tbody/tr//td[2]');
$this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
@ -80,7 +80,7 @@ class AggregatorAdminTest extends AggregatorTestBase {
// Check if the fields in the table match with what's expected.
$link = $this->xpath('//table/tbody/tr//td[1]/a');
$this->assertEquals($feed->label(), $link[0]->getText());
$count = $this->container->get('entity.manager')->getStorage('aggregator_item')->getItemCount($feed);
$count = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->getItemCount($feed);
$td = $this->xpath('//table/tbody/tr//td[2]');
$this->assertEquals(\Drupal::translation()->formatPlural($count, '1 item', '@count items'), $td[0]->getText());
}

View File

@ -55,7 +55,7 @@ class AggregatorRenderingTest extends AggregatorTestBase {
$this->assertText($block->label(), 'Feed block is displayed on the page.');
// Confirm items appear as links.
$items = $this->container->get('entity.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
$items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
$links = $this->xpath('//a[@href = :href]', [':href' => reset($items)->getLink()]);
$this->assert(isset($links[0]), 'Item link found.');

View File

@ -34,7 +34,7 @@ class DeleteFeedTest extends AggregatorTestBase {
// Delete feed.
$this->deleteFeed($feed1);
$this->assertText($feed2->label());
$block_storage = $this->container->get('entity.manager')->getStorage('block');
$block_storage = $this->container->get('entity_type.manager')->getStorage('block');
$this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
$this->assertEqual($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');

View File

@ -55,8 +55,8 @@ class IntegrationTest extends ViewsKernelTestBase {
ViewTestData::createTestViews(get_class($this), ['aggregator_test_views']);
$this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed');
$this->itemStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_item');
$this->feedStorage = $this->container->get('entity_type.manager')->getStorage('aggregator_feed');
}
/**

View File

@ -110,7 +110,7 @@ class BlockForm extends EntityForm {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('plugin.manager.condition'),
$container->get('context.repository'),
$container->get('language_manager'),

View File

@ -98,8 +98,8 @@ class BlockPageVariant extends VariantBase implements PageVariantInterface, Cont
$plugin_id,
$plugin_definition,
$container->get('block.repository'),
$container->get('entity.manager')->getViewBuilder('block'),
$container->get('entity.manager')->getDefinition('block')->getListCacheTags()
$container->get('entity_type.manager')->getViewBuilder('block'),
$container->get('entity_type.manager')->getDefinition('block')->getListCacheTags()
);
}

View File

@ -46,7 +46,7 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
$migration_configuration = [
'migration' => [
'd6_custom_block',
@ -57,7 +57,7 @@ class BlockPluginId extends ProcessPluginBase implements ContainerFactoryPluginI
$configuration,
$plugin_id,
$plugin_definition,
$entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL,
$entity_type_manager->getDefinition('block_content') ? $entity_type_manager->getStorage('block_content') : NULL,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
);
}

View File

@ -44,11 +44,11 @@ class BlockFormTest extends UnitTestCase {
protected $themeHandler;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked context repository.
@ -74,10 +74,10 @@ class BlockFormTest extends UnitTestCase {
$this->language = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->contextRepository = $this->getMock('Drupal\Core\Plugin\Context\ContextRepositoryInterface');
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->storage = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
$this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$this->entityManager->expects($this->any())
$this->entityTypeManager->expects($this->any())
->method('getStorage')
->will($this->returnValue($this->storage));
@ -136,7 +136,7 @@ class BlockFormTest extends UnitTestCase {
->method('getQuery')
->will($this->returnValue($query));
$block_form_controller = new BlockForm($this->entityManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal());
$block_form_controller = new BlockForm($this->entityTypeManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal());
// Ensure that the block with just one other instance gets the next available
// name suggestion.

View File

@ -37,10 +37,10 @@ class BlockContentController extends ControllerBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('block_content'),
$entity_manager->getStorage('block_content_type'),
$entity_type_manager->getStorage('block_content'),
$entity_type_manager->getStorage('block_content_type'),
$container->get('theme_handler')
);
}

View File

@ -33,9 +33,9 @@ class BlockContent extends DeriverBase implements ContainerDeriverInterface {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('block_content')
$entity_type_manager->getStorage('block_content')
);
}

View File

@ -71,7 +71,7 @@ class BlockContentCacheTagsTest extends EntityCacheTagsTestBase {
*/
public function testBlock() {
$block = $this->drupalPlaceBlock('block_content:' . $this->entity->uuid());
$build = $this->container->get('entity.manager')->getViewBuilder('block')->view($block, 'block');
$build = $this->container->get('entity_type.manager')->getViewBuilder('block')->view($block, 'block');
// Render the block.
// @todo The request stack manipulation won't be necessary once

View File

@ -72,7 +72,7 @@ class BlockContentListTest extends BlockContentTestBase {
// Edit the entity using the operations link.
$blocks = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content')
->loadByProperties(['info' => $label]);
$block = reset($blocks);

View File

@ -79,7 +79,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
// Edit the entity using the operations link.
$blocks = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content')
->loadByProperties(['info' => $label]);
$block = reset($blocks);

View File

@ -187,7 +187,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
// Get the custom block storage.
$storage = $this->container
->get('entity.manager')
->get('entity_type.manager')
->getStorage('block_content');
// Install all themes.

View File

@ -51,9 +51,9 @@ class BookAdminEditForm extends FormBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$entity_type_manager = $container->get('entity_type.manager');
return new static(
$entity_manager->getStorage('node'),
$entity_type_manager->getStorage('node'),
$container->get('book.manager')
);
}

View File

@ -78,7 +78,7 @@ class BookNavigationBlock extends BlockBase implements ContainerFactoryPluginInt
$plugin_definition,
$container->get('request_stack'),
$container->get('book.manager'),
$container->get('entity.manager')->getStorage('node')
$container->get('entity_type.manager')->getStorage('node')
);
}

View File

@ -52,7 +52,7 @@ class TopLevelBook extends Node {
$plugin_id,
$plugin_definition,
$container->get('current_route_match'),
$container->get('entity.manager')->getStorage('node')
$container->get('entity_type.manager')->getStorage('node')
);
}

View File

@ -340,7 +340,7 @@ class BookTest extends BrowserTestBase {
* Tests the access for deleting top-level book nodes.
*/
public function testBookDelete() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$nodes = $this->createBook();
$this->drupalLogin($this->adminUser);
$edit = [];

View File

@ -13,11 +13,11 @@ use Drupal\Tests\UnitTestCase;
class BookManagerTest extends UnitTestCase {
/**
* The mocked entity manager.
* The mocked entity type manager.
*
* @var \Drupal\Core\Entity\EntityManager|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked config factory.
@ -58,12 +58,12 @@ class BookManagerTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
$this->entityManager = $this->createMock(EntityTypeManagerInterface::class);
$this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$this->translation = $this->getStringTranslationStub();
$this->configFactory = $this->getConfigFactoryStub([]);
$this->bookOutlineStorage = $this->getMock('Drupal\book\BookOutlineStorageInterface');
$this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
$this->bookManager = new BookManager($this->entityManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer);
$this->bookManager = new BookManager($this->entityTypeManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer);
}
/**

View File

@ -52,7 +52,7 @@ class Color extends VariableMultiRow {
$plugin_definition,
$migration,
$container->get('state'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('theme_handler')
);
}

View File

@ -65,7 +65,7 @@ class UnpublishByKeywordComment extends ConfigurableActionBase implements Contai
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity.manager')->getViewBuilder('comment'),
$container->get('entity_type.manager')->getViewBuilder('comment'),
$container->get('renderer')
);
}

View File

@ -47,7 +47,7 @@ class UnapprovedComments extends LocalTaskDefault implements ContainerFactoryPlu
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity.manager')->getStorage('comment')
$container->get('entity_type.manager')->getStorage('comment')
);
}

View File

@ -42,7 +42,7 @@ class CommentNameConstraintValidator extends ConstraintValidator implements Cont
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity.manager')->getStorage('user'));
return new static($container->get('entity_type.manager')->getStorage('user'));
}
/**

View File

@ -39,7 +39,7 @@ class CommentStatisticsTest extends CommentTestBase {
* Tests the node comment statistics.
*/
public function testCommentNodeCommentStatistics() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
// Set comments to have subject and preview disabled.
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_DISABLED);

View File

@ -48,9 +48,9 @@ abstract class CommentViewsKernelTestBase extends ViewsKernelTestBase {
$this->installEntitySchema('comment');
$this->installConfig(['user']);
$entity_manager = $this->container->get('entity.manager');
$this->commentStorage = $entity_manager->getStorage('comment');
$this->userStorage = $entity_manager->getStorage('user');
$entity_type_manager = $this->container->get('entity_type.manager');
$this->commentStorage = $entity_type_manager->getStorage('comment');
$this->userStorage = $entity_type_manager->getStorage('user');
// Insert a row for the anonymous user.
$this->userStorage

View File

@ -33,7 +33,7 @@ class ConfigDependencyWebTest extends BrowserTestBase {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
/** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */
$storage = $this->container->get('entity.manager')->getStorage('config_test');
$storage = $this->container->get('entity_type.manager')->getStorage('config_test');
// Entity1 will be deleted by the test.
$entity1 = $storage->create(
[

View File

@ -26,7 +26,7 @@ class ConfigEntityFormOverrideTest extends BrowserTestBase {
$overridden_label = 'Overridden label';
$edited_label = 'Edited label';
$config_test_storage = $this->container->get('entity.manager')->getStorage('config_test');
$config_test_storage = $this->container->get('entity_type.manager')->getStorage('config_test');
// Set up an override.
$settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [

View File

@ -121,7 +121,7 @@ class ConfigEntityListTest extends BrowserTestBase {
// Test that config entities that do not support status, do not have
// enable/disable operations.
$controller = $this->container->get('entity.manager')
$controller = $this->container->get('entity_type.manager')
->getListBuilder('config_test_no_status');
$list = $controller->load();

View File

@ -148,7 +148,7 @@ class ConfigTranslationOverviewTest extends BrowserTestBase {
$original_label = 'Default';
$overridden_label = 'Overridden label';
$config_test_storage = $this->container->get('entity.manager')->getStorage('config_test');
$config_test_storage = $this->container->get('entity_type.manager')->getStorage('config_test');
// Set up an override.
$settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [

View File

@ -22,11 +22,11 @@ class ConfigEntityMapperTest extends UnitTestCase {
protected $configEntityMapper;
/**
* The entity manager used for testing.
* The entity type manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The entity instance used for testing.
@ -57,7 +57,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
protected $eventDispatcher;
protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
@ -97,7 +97,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->routeProvider,
$this->getStringTranslationStub(),
$this->entityManager,
$this->entityTypeManager,
$this->languageManager,
$this->eventDispatcher
);
@ -118,7 +118,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
->expects($this->any())
->method('getConfigPrefix')
->will($this->returnValue('config_prefix'));
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
@ -147,7 +147,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
*/
public function testGetOverviewRouteParameters() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
@ -181,7 +181,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
$entity_type->expects($this->once())
->method('getLabel')
->will($this->returnValue('test'));
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')
@ -199,7 +199,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
$entity_type->expects($this->once())
->method('getLabel')
->will($this->returnValue('test'));
$this->entityManager
$this->entityTypeManager
->expects($this->once())
->method('getDefinition')
->with('configurable_language')

View File

@ -29,11 +29,11 @@ class ConfigFieldMapperTest extends UnitTestCase {
protected $entity;
/**
* The entity manager used for testing.
* The entity type manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The mocked event dispatcher.
@ -46,7 +46,7 @@ class ConfigFieldMapperTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entityTypeManager = $this->getMock('Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entity = $this->getMock('Drupal\field\FieldConfigInterface');
$definition = [
@ -72,7 +72,7 @@ class ConfigFieldMapperTest extends UnitTestCase {
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->getMock('Drupal\Core\Routing\RouteProviderInterface'),
$this->getStringTranslationStub(),
$this->entityManager,
$this->entityTypeManager,
$this->getMock('Drupal\Core\Language\LanguageManagerInterface'),
$this->eventDispatcher
);
@ -90,7 +90,7 @@ class ConfigFieldMapperTest extends UnitTestCase {
->method('getConfigPrefix')
->will($this->returnValue('config_prefix'));
$this->entityManager
$this->entityTypeManager
->expects($this->any())
->method('getDefinition')
->will($this->returnValue($entity_type));

View File

@ -34,7 +34,7 @@ class MessageEntityTest extends EntityKernelTestBase {
* Test some of the methods.
*/
public function testMessageMethods() {
$message_storage = $this->container->get('entity.manager')->getStorage('contact_message');
$message_storage = $this->container->get('entity_type.manager')->getStorage('contact_message');
$message = $message_storage->create(['contact_form' => 'feedback']);
// Check for empty values first.

View File

@ -25,7 +25,7 @@ class ContentTranslationPermissions implements ContainerInjectionInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

View File

@ -228,7 +228,7 @@ abstract class ContentTranslationTestBase extends WebTestBase {
if ($bundle_key = $entity_type->getKey('bundle')) {
$entity_values[$bundle_key] = $bundle_name ?: $this->bundle;
}
$controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId);
$controller = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId);
if (!($controller instanceof SqlContentEntityStorage)) {
foreach ($values as $property => $value) {
if (is_array($value)) {

View File

@ -285,14 +285,4 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$this->assertNoField('settings[entity_test][entity_test][translatable]');
}
/**
* Returns the entity manager.
*
* @return \Drupal\Core\Entity\EntityManagerInterface
* The entity manager;
*/
protected function entityManager() {
return $this->container->get('entity.manager');
}
}

View File

@ -222,8 +222,8 @@ abstract class ContentTranslationTestBase extends BrowserTestBase {
if ($bundle_key = $entity_type->getKey('bundle')) {
$entity_values[$bundle_key] = $bundle_name ?: $this->bundle;
}
$controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId);
if (!($controller instanceof SqlContentEntityStorage)) {
$storage = $this->container->get('entity_type.manager')->getStorage($this->entityTypeId);
if (!($storage instanceof SqlContentEntityStorage)) {
foreach ($values as $property => $value) {
if (is_array($value)) {
$entity_values[$property] = [$langcode => $value];

View File

@ -30,13 +30,6 @@ class ContentTranslationUpdateTest extends UpdatePathTestBase {
*/
protected $entityDefinitionUpdateManager;
/**
* The entity manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* The state service.
*
@ -52,7 +45,6 @@ class ContentTranslationUpdateTest extends UpdatePathTestBase {
$this->database = \Drupal::database();
$this->entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
$this->entityManager = \Drupal::entityManager();
$this->state = \Drupal::state();
}

View File

@ -96,7 +96,7 @@ class ContentTranslationConfigImportTest extends KernelTestBase {
$this->assertIdentical($config->get('id'), $config_id);
// Verify that updates were performed.
$entity_type = $this->container->get('entity.manager')->getDefinition($entity_type_id);
$entity_type = $this->container->get('entity_type.manager')->getDefinition($entity_type_id);
$table = $entity_type->getDataTable();
$db_schema = $this->container->get('database')->schema();
$result = $db_schema->fieldExists($table, 'content_translation_source') && $db_schema->fieldExists($table, 'content_translation_outdated');

View File

@ -75,7 +75,7 @@ abstract class DateTimeFormatterBase extends FormatterBase implements ContainerF
$configuration['view_mode'],
$configuration['third_party_settings'],
$container->get('date.formatter'),
$container->get('entity.manager')->getStorage('date_format')
$container->get('entity_type.manager')->getStorage('date_format')
);
}

View File

@ -49,7 +49,7 @@ class DateTimeDefaultWidget extends DateTimeWidgetBase implements ContainerFacto
$configuration['field_definition'],
$configuration['settings'],
$configuration['third_party_settings'],
$container->get('entity.manager')->getStorage('date_format')
$container->get('entity_type.manager')->getStorage('date_format')
);
}

View File

@ -43,7 +43,7 @@ class EditorImageDialog extends FormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('file')
$container->get('entity_type.manager')->getStorage('file')
);
}

View File

@ -3,7 +3,6 @@
namespace Drupal\Tests\editor\Unit;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\editor\Entity\Editor;
use Drupal\Tests\UnitTestCase;
@ -80,16 +79,10 @@ class EditorConfigEntityUnitTest extends UnitTestCase {
->disableOriginalConstructor()
->getMock();
$entity_manager = new EntityManager();
$container = new ContainerBuilder();
$container->set('entity.manager', $entity_manager);
$container->set('entity_type.manager', $this->entityTypeManager);
$container->set('uuid', $this->uuid);
$container->set('plugin.manager.editor', $this->editorPluginManager);
// Inject the container into entity.manager so it can defer to
// entity_type.manager.
$entity_manager->setContainer($container);
\Drupal::setContainer($container);
}

View File

@ -83,7 +83,7 @@ class FieldConfigStorage extends FieldConfigStorageBase {
$container->get('config.factory'),
$container->get('uuid'),
$container->get('language_manager'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('plugin.manager.field.field_type'),
$container->get('entity_field.deleted_fields_repository'),
$container->get('entity.memory_cache')

View File

@ -94,7 +94,7 @@ class FieldStorageConfigStorage extends ConfigEntityStorage {
$container->get('config.factory'),
$container->get('uuid'),
$container->get('language_manager'),
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('module_handler'),
$container->get('plugin.manager.field.field_type'),
$container->get('entity_field.deleted_fields_repository'),

View File

@ -150,7 +150,7 @@ class FormTest extends FieldTestBase {
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
$this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]);
$this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
$entity = EntityTest::load($id);
$this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated');
@ -161,7 +161,7 @@ class FormTest extends FieldTestBase {
];
$this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save'));
$this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated');
$this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]);
$this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
$entity = EntityTest::load($id);
$this->assertTrue($entity->{$field_name}->isEmpty(), 'Field was emptied');
}

View File

@ -203,7 +203,7 @@ class FieldAttachOtherTest extends FieldKernelTestBase {
$this->assertFalse(\Drupal::cache('entity')->get($cid), 'Cached: no cache entry on insert');
// Load, and check that a cache entry is present with the expected values.
$controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId());
$controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId());
$controller->resetCache();
$cached_entity = $controller->load($entity->id());
$cache = \Drupal::cache('entity')->get($cid);

View File

@ -46,7 +46,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$values[$current_revision] = $current_values;
}
$storage = $this->container->get('entity.manager')->getStorage($entity_type);
$storage = $this->container->get('entity_type.manager')->getStorage($entity_type);
$storage->resetCache();
$entity = $storage->load($entity_id);
// Confirm current revision loads the correct data.
@ -249,7 +249,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$entity->setNewRevision();
$entity->save();
$vids[] = $entity->getRevisionId();
$controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId());
$controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId());
$controller->resetCache();
// Confirm each revision loads
@ -361,7 +361,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
entity_test_delete_bundle($this->fieldTestData->field->getTargetBundle(), $entity_type);
// Verify no data gets loaded
$controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId());
$controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId());
$controller->resetCache();
$entity = $controller->load($entity->id());

View File

@ -337,7 +337,7 @@ class FieldCrudTest extends FieldKernelTestBase {
$field->save();
$field_2 = FieldConfig::create($field_definition_2);
$field_2->save();
$this->container->get('entity.manager')->getStorage('field_config')->delete([$field, $field_2]);
$this->container->get('entity_type.manager')->getStorage('field_config')->delete([$field, $field_2]);
$this->assertFalse(FieldStorageConfig::loadByName('entity_test', $field_storage->getName()));
}

View File

@ -136,7 +136,7 @@ class FieldDataCountTest extends FieldKernelTestBase {
$this->assertIdentical($this->fieldTestData->field_storage_2->hasData(), TRUE, 'There are entities with field data.');
$storage = $this->container->get('entity.manager')->getStorage($entity_type);
$storage = $this->container->get('entity_type.manager')->getStorage($entity_type);
$entity = $storage->loadRevision($first_revision);
$this->assertEqual(count($entity->{$this->fieldTestData->field_name_2}), $cardinality, format_string('Revision %revision_id: expected number of values.', ['%revision_id' => $first_revision]));
}

View File

@ -129,7 +129,7 @@ abstract class FieldKernelTestBase extends KernelTestBase {
*/
protected function entitySaveReload(EntityInterface $entity) {
$entity->save();
$controller = $this->container->get('entity.manager')->getStorage($entity->getEntityTypeId());
$controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId());
$controller->resetCache();
return $controller->load($entity->id());
}

View File

@ -11,7 +11,6 @@ use Drupal\Core\Entity\EntityType;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\UnitTestCase;
@ -32,13 +31,6 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
/**
* The entity manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
/**
* The entity type manager used for testing.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityTypeManager;
@ -85,7 +77,6 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
$this->entityTypeId = $this->randomMachineName();
$this->entityType = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$this->entityManager = new EntityManager();
$this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
$this->entityFieldManager = $this->getMock(EntityFieldManagerInterface::class);
@ -94,14 +85,10 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
$this->fieldTypePluginManager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('entity_field.manager', $this->entityFieldManager);
$container->set('entity_type.manager', $this->entityTypeManager);
$container->set('uuid', $this->uuid);
$container->set('plugin.manager.field.field_type', $this->fieldTypePluginManager);
// Inject the container into entity.manager so it can defer to
// entity_type.manager, etc.
$this->entityManager->setContainer($container);
\Drupal::setContainer($container);
// Create a mock FieldStorageConfig object.

View File

@ -6,7 +6,6 @@ use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Cache\Context\CacheContextsManager;
use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
use Drupal\Core\DependencyInjection\Container;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
@ -141,16 +140,10 @@ class FieldStorageConfigAccessControlHandlerTest extends UnitTestCase {
['field_storage_config', $storage_access_control_handler],
]);
$entity_manager = new EntityManager();
$container = new Container();
$container->set('entity.manager', $entity_manager);
$container->set('entity_type.manager', $entity_type_manager);
$container->set('uuid', $this->getMock(UuidInterface::class));
$container->set('cache_contexts_manager', $this->prophesize(CacheContextsManager::class));
// Inject the container into entity.manager so it can defer to
// entity_type.manager.
$entity_manager->setContainer($container);
\Drupal::setContainer($container);
$this->entity = new FieldStorageConfig([

View File

@ -8,7 +8,6 @@
namespace Drupal\Tests\field\Unit;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FieldException;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
@ -55,19 +54,14 @@ class FieldStorageConfigEntityUnitTest extends UnitTestCase {
* {@inheritdoc}
*/
protected function setUp() {
$entity_manager = new EntityManager();
$this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
$this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
$this->fieldTypeManager = $this->getMock(FieldTypePluginManagerInterface::class);
$container = new ContainerBuilder();
$container->set('entity.manager', $entity_manager);
$container->set('entity_type.manager', $this->entityTypeManager);
$container->set('uuid', $this->uuid);
$container->set('plugin.manager.field.field_type', $this->fieldTypeManager);
// Inject the container into entity.manager so it can defer to
// entity_type.manager.
$entity_manager->setContainer($container);
\Drupal::setContainer($container);
}

View File

@ -28,11 +28,6 @@ class ManageDisplayTest extends WebDriverTestBase {
*/
protected $type;
/**
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entity_manager;
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
@ -60,7 +55,6 @@ class ManageDisplayTest extends WebDriverTestBase {
$this->type = $type->id();
$this->entity_type_manager = $this->container->get('entity_type.manager');
$this->entity_manager = $this->container->get('entity.manager');
}
/**

View File

@ -197,7 +197,7 @@ abstract class FileFieldTestBase extends WebTestBase {
'revision' => (string) (int) $new_revision,
];
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
if (is_numeric($nid_or_type)) {
$nid = $nid_or_type;
$node_storage->resetCache([$nid]);
@ -277,7 +277,7 @@ abstract class FileFieldTestBase extends WebTestBase {
* Asserts that a file exists in the database.
*/
public function assertFileEntryExists($file, $message = NULL) {
$this->container->get('entity.manager')->getStorage('file')->resetCache();
$this->container->get('entity_type.manager')->getStorage('file')->resetCache();
$db_file = File::load($file->id());
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]);
$this->assertEqual($db_file->getFileUri(), $file->getFileUri(), $message);
@ -295,7 +295,7 @@ abstract class FileFieldTestBase extends WebTestBase {
* Asserts that a file does not exist in the database.
*/
public function assertFileEntryNotExists($file, $message) {
$this->container->get('entity.manager')->getStorage('file')->resetCache();
$this->container->get('entity_type.manager')->getStorage('file')->resetCache();
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]);
$this->assertFalse(File::load($file->id()), $message);
}

View File

@ -65,7 +65,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
// Check that the default formatter is displaying with the file name.
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$node_storage->resetCache([$nid]);
$node = $node_storage->load($nid);
$node_file = File::load($node->{$field_name}->target_id);

View File

@ -16,7 +16,7 @@ class FileFieldPathTest extends FileFieldTestBase {
*/
public function testUploadPath() {
/** @var \Drupal\node\NodeStorageInterface $node_storage */
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName());
$type_name = 'article';
$this->createFileField($field_name, 'node', $type_name);

View File

@ -22,7 +22,7 @@ class FileFieldRSSContentTest extends FileFieldTestBase {
* Tests RSS enclosure formatter display for RSS feeds.
*/
public function testFileFieldRSSContent() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName());
$type_name = 'article';

View File

@ -29,7 +29,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
$this->config('file.settings')
->set('make_unused_managed_files_temporary', TRUE)
->save();
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article';
$field_name = strtolower($this->randomMachineName());
$this->createFileField($field_name, 'node', $type_name);

View File

@ -126,7 +126,7 @@ abstract class FileFieldTestBase extends BrowserTestBase {
'revision' => (string) (int) $new_revision,
];
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
if (is_numeric($nid_or_type)) {
$nid = $nid_or_type;
$node_storage->resetCache([$nid]);
@ -220,7 +220,7 @@ abstract class FileFieldTestBase extends BrowserTestBase {
* Asserts that a file exists in the database.
*/
public function assertFileEntryExists($file, $message = NULL) {
$this->container->get('entity.manager')->getStorage('file')->resetCache();
$this->container->get('entity_type.manager')->getStorage('file')->resetCache();
$db_file = File::load($file->id());
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]);
$this->assertEqual($db_file->getFileUri(), $file->getFileUri(), $message);
@ -247,7 +247,7 @@ abstract class FileFieldTestBase extends BrowserTestBase {
* Asserts that a file does not exist in the database.
*/
public function assertFileEntryNotExists($file, $message) {
$this->container->get('entity.manager')->getStorage('file')->resetCache();
$this->container->get('entity_type.manager')->getStorage('file')->resetCache();
$message = isset($message) ? $message : format_string('File %file exists in database at the correct path.', ['%file' => $file->getFileUri()]);
$this->assertFalse(File::load($file->id()), $message);
}

View File

@ -18,7 +18,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
* Tests the required property on file fields.
*/
public function testRequired() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article';
$field_name = strtolower($this->randomMachineName());
$storage = $this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']);
@ -66,7 +66,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
* Tests the max file size validator.
*/
public function testFileMaxSize() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article';
$field_name = strtolower($this->randomMachineName());
$this->createFileField($field_name, 'node', $type_name, [], ['required' => '1']);
@ -117,7 +117,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
* Tests file extension checking.
*/
public function testFileExtension() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article';
$field_name = strtolower($this->randomMachineName());
$this->createFileField($field_name, 'node', $type_name);
@ -160,7 +160,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
* Checks that a file can always be removed if it does not pass validation.
*/
public function testFileRemoval() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article';
$field_name = 'file_test';
$this->createFileField($field_name, 'node', $type_name);

View File

@ -113,7 +113,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
* Tests upload and remove buttons for multiple multi-valued File fields.
*/
public function testMultiValuedWidget() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$type_name = 'article';
// Use explicit names instead of random names for those fields, because of a
// bug in drupalPostForm() with multiple file uploads in one form, where the
@ -239,7 +239,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
* Tests a file field with a "Private files" upload destination setting.
*/
public function testPrivateFileSetting() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
// Grant the admin user required permissions.
user_role_grant_permissions($this->adminUser->roles[0]->target_id, ['administer node fields']);

View File

@ -37,7 +37,7 @@ class FilePrivateTest extends FileFieldTestBase {
* Tests file access for file uploaded to a private node.
*/
public function testPrivateFile() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
$type_name = 'article';
@ -139,7 +139,7 @@ class FilePrivateTest extends FileFieldTestBase {
$edit = ['files[' . $field_name . '_0]' => $file_system->realpath($test_file->getFileUri())];
$this->drupalPostForm(NULL, $edit, t('Upload'));
/** @var \Drupal\file\FileStorageInterface $file_storage */
$file_storage = $this->container->get('entity.manager')->getStorage('file');
$file_storage = $this->container->get('entity_type.manager')->getStorage('file');
$files = $file_storage->loadByProperties(['uid' => 0]);
$this->assertEqual(1, count($files), 'Loaded one anonymous file.');
$file = end($files);

View File

@ -18,7 +18,7 @@ class FileTokenReplaceTest extends FileFieldTestBase {
* Creates a file, then tests the tokens generated from it.
*/
public function testFileTokenReplacement() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$token_service = \Drupal::token();
$language_interface = \Drupal::languageManager()->getCurrentLanguage();
/** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */

View File

@ -69,7 +69,7 @@ class MigrateUploadTest extends MigrateDrupal6TestBase {
* Test upload migration from Drupal 6 to Drupal 8.
*/
public function testUpload() {
$this->container->get('entity.manager')
$this->container->get('entity_type.manager')
->getStorage('node')
->resetCache([1, 2, 12]);

View File

@ -55,7 +55,7 @@ class SpaceUsedTest extends FileManagedUnitTestBase {
* Test different users with the default status.
*/
public function testFileSpaceUsed() {
$file = $this->container->get('entity.manager')->getStorage('file');
$file = $this->container->get('entity_type.manager')->getStorage('file');
// Test different users with default status.
$this->assertEqual($file->spaceUsed(2), 70);
$this->assertEqual($file->spaceUsed(3), 300);

View File

@ -42,7 +42,7 @@ class FilterPermissions implements ContainerInjectionInterface {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity.manager'));
return new static($container->get('entity_type.manager'));
}
/**

View File

@ -39,11 +39,11 @@ class ForumIntegrationTest extends ViewTestBase {
*/
public function testForumIntegration() {
// Create a forum.
$entity_manager = $this->container->get('entity.manager');
$term = $entity_manager->getStorage('taxonomy_term')->create(['vid' => 'forums', 'name' => $this->randomMachineName()]);
$entity_type_manager = $this->container->get('entity_type.manager');
$term = $entity_type_manager->getStorage('taxonomy_term')->create(['vid' => 'forums', 'name' => $this->randomMachineName()]);
$term->save();
$comment_storage = $entity_manager->getStorage('comment');
$comment_storage = $entity_type_manager->getStorage('comment');
// Create some nodes which are part of this forum with some comments.
$nodes = [];

View File

@ -42,7 +42,7 @@ class ImageStyleEditForm extends ImageStyleFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('image_style'),
$container->get('entity_type.manager')->getStorage('image_style'),
$container->get('plugin.manager.image.effect')
);
}

View File

@ -41,7 +41,7 @@ abstract class ImageStyleFormBase extends EntityForm {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('image_style')
$container->get('entity_type.manager')->getStorage('image_style')
);
}

View File

@ -85,7 +85,7 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
$configuration['view_mode'],
$configuration['third_party_settings'],
$container->get('current_user'),
$container->get('entity.manager')->getStorage('image_style')
$container->get('entity_type.manager')->getStorage('image_style')
);
}

View File

@ -35,7 +35,7 @@ class ImageFieldDefaultImagesTest extends ImageFieldTestBase {
* Tests CRUD for fields and field storages with default images.
*/
public function testDefaultImages() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
// Create files to use as the default images.
$files = $this->drupalGetTestFiles('image');
// Create 10 files so the default image fids are not a single value.

View File

@ -54,7 +54,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
public function _testImageFieldFormatters($scheme) {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$field_name = strtolower($this->randomMachineName());
$field_settings = ['alt_field_required' => 0];
$instance = $this->createImageField($field_name, 'article', ['uri_scheme' => $scheme], $field_settings);
@ -230,7 +230,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
public function testImageFieldSettings() {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
$test_image = current($this->drupalGetTestFiles('image'));
list(, $test_image_extension) = explode('.', $test_image->filename);
$field_name = strtolower($this->randomMachineName());
@ -349,7 +349,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container->get('renderer');
$node_storage = $this->container->get('entity.manager')->getStorage('node');
$node_storage = $this->container->get('entity_type.manager')->getStorage('node');
// Create a new image field.
$field_name = strtolower($this->randomMachineName());
$this->createImageField($field_name, 'article');

View File

@ -88,7 +88,7 @@ class ImageStyleIntegrationTest extends KernelTestBase {
// of selecting a replacement style by setting the replacement image style
// ID in the image style storage.
/** @var \Drupal\image\ImageStyleStorageInterface $storage */
$storage = $this->container->get('entity.manager')->getStorage($style->getEntityTypeId());
$storage = $this->container->get('entity_type.manager')->getStorage($style->getEntityTypeId());
$storage->setReplacementId('main_style', 'replacement_style');
$style->delete();

View File

@ -20,11 +20,11 @@ class ImageStyleTest extends UnitTestCase {
protected $entityType;
/**
* The entity manager used for testing.
* The entity type manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
protected $entityTypeManager;
/**
* The ID of the type of the entity under test.
@ -92,8 +92,8 @@ class ImageStyleTest extends UnitTestCase {
$this->entityType->expects($this->any())
->method('getProvider')
->will($this->returnValue($this->provider));
$this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
$this->entityManager->expects($this->any())
$this->entityTypeManager = $this->getMock('\Drupal\Core\Entity\EntityTypeManagerInterface');
$this->entityTypeManager->expects($this->any())
->method('getDefinition')
->with($this->entityTypeId)
->will($this->returnValue($this->entityType));

View File

@ -93,8 +93,8 @@ class NegotiationConfigureForm extends ConfigFormBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$entity_manager = $container->get('entity.manager');
$block_storage = $entity_manager->hasHandler('block', 'storage') ? $entity_manager->getStorage('block') : NULL;
$entity_type_manager = $container->get('entity_type.manager');
$block_storage = $entity_type_manager->hasHandler('block', 'storage') ? $entity_type_manager->getStorage('block') : NULL;
return new static(
$container->get('config.factory'),
$container->get('language_manager'),

View File

@ -90,7 +90,7 @@ class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase imp
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($container->get('entity.manager'));
return new static($container->get('entity_type.manager'));
}
/**

View File

@ -29,7 +29,7 @@ class EntityDefaultLanguageTest extends KernelTestBase {
$this->installEntitySchema('user');
// Activate Spanish language, so there are two languages activated.
$language = $this->container->get('entity.manager')->getStorage('configurable_language')->create([
$language = $this->container->get('entity_type.manager')->getStorage('configurable_language')->create([
'id' => 'es',
]);
$language->save();
@ -101,7 +101,7 @@ class EntityDefaultLanguageTest extends KernelTestBase {
* Default language code of the nodes of this type.
*/
protected function createContentType($name, $langcode) {
$content_type = $this->container->get('entity.manager')->getStorage('node_type')->create([
$content_type = $this->container->get('entity_type.manager')->getStorage('node_type')->create([
'name' => 'Test ' . $name,
'title_label' => 'Title',
'type' => $name,
@ -134,7 +134,7 @@ class EntityDefaultLanguageTest extends KernelTestBase {
if (!empty($langcode)) {
$values['langcode'] = $langcode;
}
$node = $this->container->get('entity.manager')->getStorage('node')->create($values);
$node = $this->container->get('entity_type.manager')->getStorage('node')->create($values);
return $node;
}

View File

@ -4,7 +4,6 @@ namespace Drupal\Tests\language\Unit;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeRepositoryInterface;
use Drupal\language\Entity\ContentLanguageSettings;
@ -23,13 +22,6 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
*/
protected $entityType;
/**
* The entity manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
/**
* The entity type manager used for testing.
*
@ -72,7 +64,6 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
$this->entityTypeId = $this->randomMachineName();
$this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
$this->entityManager = new EntityManager();
$this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
$this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
@ -82,14 +73,10 @@ class ContentLanguageSettingsUnitTest extends UnitTestCase {
$this->configEntityStorageInterface = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('entity_type.manager', $this->entityTypeManager);
$container->set('uuid', $this->uuid);
$container->set('config.typed', $this->typedConfigManager);
$container->set('config.storage', $this->configEntityStorageInterface);
// Inject the container into entity.manager so it can defer to other entity
// services.
$this->entityManager->setContainer($container);
\Drupal::setContainer($container);
}

View File

@ -32,9 +32,9 @@ class DefaultsSectionStorageTest extends UnitTestCase {
protected $plugin;
/**
* The entity manager.
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

View File

@ -668,7 +668,7 @@ class LinkFieldTest extends BrowserTestBase {
],
])->save();
$this->container->get('entity.manager')
$this->container->get('entity_type.manager')
->getStorage('entity_form_display')
->load('entity_test.entity_test.default')
->setComponent($field_name, [
@ -823,7 +823,7 @@ class LinkFieldTest extends BrowserTestBase {
*/
protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
if ($reset) {
$this->container->get('entity.manager')->getStorage('entity_test')->resetCache([$id]);
$this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
}
$entity = EntityTest::load($id);
$display = \Drupal::service('entity_display.repository')

Some files were not shown because too many files have changed in this diff Show More