/**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setup();
     require_once $this->root . '/core/includes/entity.inc';
     $this->namespaces['Drupal\\Core\\Entity'] = $this->root . '/core/lib/Drupal/Core/Entity';
     $language = $this->prophesize(LanguageInterface::class);
     $language->getId()->willReturn('en');
     $this->languageManager = $this->prophesize(LanguageManagerInterface::class);
     $this->languageManager->getCurrentLanguage()->willReturn($language->reveal());
     $this->languageManager->getLanguages()->willReturn([$language->reveal()]);
     // We need to support multiple entity types, including a test type:
     $type_info = ['test' => ['id' => 'test', 'label' => 'Test', 'entity_keys' => ['bundle' => 'bundle']], 'user' => ['id' => 'user', 'label' => 'Test User', 'entity_keys' => ['bundle' => 'user']], 'node' => ['id' => 'node', 'label' => 'Test Node', 'entity_keys' => ['bundle' => 'dummy']]];
     $type_array = [];
     foreach ($type_info as $type => $info) {
         $entity_type = new ContentEntityType($info);
         $type_array[$type] = $entity_type;
         $this->entityTypeManager->getDefinition($type)->willReturn($entity_type);
         $this->entityManager->getDefinition($type)->willReturn($entity_type);
     }
     // We need a user_role mock as well.
     $role_entity_info = ['id' => 'user_role', 'label' => 'Test Role'];
     $role_type = new ConfigEntityType($role_entity_info);
     $type_array['user_role'] = $role_type;
     $this->entityTypeManager->getDefinitions()->willReturn($type_array);
     $this->entityManager->getDefinitions()->willReturn($type_array);
     $this->entityAccess = $this->prophesize(EntityAccessControlHandlerInterface::class);
     $this->entityTypeManager->getAccessControlHandler(Argument::any())->willReturn($this->entityAccess->reveal());
     // The base field definitions for our test entity aren't used, and would
     // require additional mocking. It doesn't appear that any of our tests rely
     // on this for any other entity type that we are mocking.
     $this->entityFieldManager->getBaseFieldDefinitions(Argument::any())->willReturn([]);
     $this->entityManager->getBaseFieldDefinitions(Argument::any())->willReturn([]);
     // Return some dummy bundle information for now, so that the entity manager
     // does not call out to the config entity system to get bundle information.
     $this->entityTypeBundleInfo->getBundleInfo(Argument::any())->willReturn(['test' => ['label' => 'Test']]);
     $this->entityManager->getBundleInfo(Argument::any())->willReturn(['test' => ['label' => 'Test']]);
     $this->moduleHandler->getImplementations('entity_type_build')->willReturn([]);
     $this->fieldTypeManager = new FieldTypePluginManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal(), $this->typedDataManager);
     $this->container->set('plugin.manager.field.field_type', $this->fieldTypeManager);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setup();
     require_once $this->root . '/core/includes/entity.inc';
     $this->namespaces['Drupal\\Core\\Entity'] = $this->root . '/core/lib/Drupal/Core/Entity';
     $language = $this->prophesize(LanguageInterface::class);
     $language->getId()->willReturn('en');
     $this->languageManager = $this->prophesize(LanguageManagerInterface::class);
     $this->languageManager->getCurrentLanguage()->willReturn($language->reveal());
     $this->languageManager->getLanguages()->willReturn([$language->reveal()]);
     $entityType = new ContentEntityType(['id' => 'test', 'label' => 'Test', 'entity_keys' => ['bundle' => 'bundle']]);
     $this->entityManager->getDefinitions()->willReturn(['test' => $entityType]);
     $this->entityAccess = $this->prophesize(EntityAccessControlHandlerInterface::class);
     $this->entityManager->getAccessControlHandler(Argument::any())->willReturn($this->entityAccess->reveal());
     // The base field definitions for our test entity aren't used, and would
     // require additional mocking.
     $this->entityManager->getBaseFieldDefinitions('test')->willReturn([]);
     // Return some dummy bundle information for now, so that the entity manager
     // does not call out to the config entity system to get bundle information.
     $this->entityManager->getBundleInfo(Argument::any())->willReturn(['test' => ['label' => 'Test']]);
     $this->moduleHandler->getImplementations('entity_type_build')->willReturn([]);
 }