Commit da0a2367 authored by catch's avatar catch

Issue #3045525 by martin107, Berdir: EntityDeriver: deprecate entityManager.

(cherry picked from commit 34b3a5e9)
parent 84e5d23c
......@@ -63,7 +63,7 @@ public function __construct($base_plugin_id, EntityManagerInterface $entity_mana
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$base_plugin_id,
$container->get('entity.manager'),
$container->get('entity_type.manager'),
$container->get('entity_type.bundle.info')
);
}
......
......@@ -3,7 +3,7 @@
namespace Drupal\KernelTests\Core\Entity;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\TypedData\EntityDataDefinition;
use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
......@@ -154,10 +154,11 @@ public function testEntityDefinitionIsInternal($internal, $expected) {
$entity_type->getLabel()->willReturn($this->randomString());
$entity_type->getConstraints()->willReturn([]);
$entity_type->isInternal()->willReturn($internal);
$entity_type->getBundleEntityType()->willReturn(NULL);
$entity_manager = $this->prophesize(EntityManagerInterface::class);
$entity_manager->getDefinitions()->willReturn([$entity_type_id => $entity_type->reveal()]);
$this->container->set('entity.manager', $entity_manager->reveal());
$entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
$entity_type_manager->getDefinitions()->willReturn([$entity_type_id => $entity_type->reveal()]);
$this->container->set('entity_type.manager', $entity_type_manager->reveal());
$entity_data_definition = EntityDataDefinition::create($entity_type_id);
$this->assertSame($expected, $entity_data_definition->isInternal());
......
......@@ -7,7 +7,6 @@
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\ContentEntityStorageInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityType;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
......@@ -36,13 +35,6 @@ class EntityContextDefinitionIsSatisfiedTest extends UnitTestCase {
*/
protected $entityTypeManager;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* The entity type bundle info.
*
......@@ -74,8 +66,6 @@ protected function setUp() {
$type_data_manager->setValidationConstraintManager(new ConstraintManager($namespaces, $cache_backend, $module_handler->reveal()));
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
$string_translation = new TranslationManager(new LanguageDefault([]));
......@@ -83,7 +73,6 @@ protected function setUp() {
$container = new ContainerBuilder();
$container->set('typed_data_manager', $type_data_manager);
$container->set('entity_type.manager', $this->entityTypeManager->reveal());
$container->set('entity.manager', $this->entityManager->reveal());
$container->set('entity_type.bundle.info', $this->entityTypeBundleInfo->reveal());
$container->set('string_translation', $string_translation);
\Drupal::setContainer($container);
......@@ -124,7 +113,7 @@ public function testIsSatisfiedBy($expected, ContextDefinition $requirement, Con
$content_entity_type = new EntityType(['id' => 'test_content']);
$this->entityTypeManager->getDefinition('test_config')->willReturn($config_entity_type);
$this->entityTypeManager->getDefinition('test_content')->willReturn($content_entity_type);
$this->entityManager->getDefinitions()->willReturn([
$this->entityTypeManager->getDefinitions()->willReturn([
'test_config' => $config_entity_type,
'test_content' => $content_entity_type,
]);
......@@ -229,7 +218,7 @@ public function testIsSatisfiedByGenerateBundledEntity($expected, array $require
$this->entityTypeManager->getStorage('test_content')->willReturn($content_entity_storage->reveal());
$this->entityTypeManager->getDefinition('test_content')->willReturn($entity_type);
$this->entityManager->getDefinitions()->willReturn([
$this->entityTypeManager->getDefinitions()->willReturn([
'test_content' => $entity_type,
]);
......@@ -297,7 +286,7 @@ public function providerTestIsSatisfiedByGenerateBundledEntity() {
*/
public function testIsSatisfiedByPassBundledEntity($expected, $requirement_constraint) {
$entity_type = new EntityType(['id' => 'test_content']);
$this->entityManager->getDefinitions()->willReturn([
$this->entityTypeManager->getDefinitions()->willReturn([
'test_content' => $entity_type,
]);
$this->entityTypeManager->getDefinition('test_content')->willReturn($entity_type);
......
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