Skip to content
Snippets Groups Projects
Unverified Commit 7e745c9a authored by Alex Pott's avatar Alex Pott
Browse files

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

This reverts commit da0a2367.
parent 4559088c
Branches
Tags
No related merge requests found
......@@ -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_type.manager'),
$container->get('entity.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\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\TypedData\EntityDataDefinition;
use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
......@@ -154,11 +154,10 @@ 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_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_manager = $this->prophesize(EntityManagerInterface::class);
$entity_manager->getDefinitions()->willReturn([$entity_type_id => $entity_type->reveal()]);
$this->container->set('entity.manager', $entity_manager->reveal());
$entity_data_definition = EntityDataDefinition::create($entity_type_id);
$this->assertSame($expected, $entity_data_definition->isInternal());
......
......
......@@ -7,6 +7,7 @@
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;
......@@ -35,6 +36,13 @@ class EntityContextDefinitionIsSatisfiedTest extends UnitTestCase {
*/
protected $entityTypeManager;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* The entity type bundle info.
*
......@@ -66,6 +74,8 @@ 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([]));
......@@ -73,6 +83,7 @@ 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);
......@@ -113,7 +124,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->entityTypeManager->getDefinitions()->willReturn([
$this->entityManager->getDefinitions()->willReturn([
'test_config' => $config_entity_type,
'test_content' => $content_entity_type,
]);
......@@ -218,7 +229,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->entityTypeManager->getDefinitions()->willReturn([
$this->entityManager->getDefinitions()->willReturn([
'test_content' => $entity_type,
]);
......@@ -286,7 +297,7 @@ public function providerTestIsSatisfiedByGenerateBundledEntity() {
*/
public function testIsSatisfiedByPassBundledEntity($expected, $requirement_constraint) {
$entity_type = new EntityType(['id' => 'test_content']);
$this->entityTypeManager->getDefinitions()->willReturn([
$this->entityManager->getDefinitions()->willReturn([
'test_content' => $entity_type,
]);
$this->entityTypeManager->getDefinition('test_content')->willReturn($entity_type);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment