ConfigEntityStorage example

$this->uuidService = $this->prophesize(UuidInterface::class);

    $this->languageManager = $this->prophesize(LanguageManagerInterface::class);
    $this->languageManager->getCurrentLanguage()->willReturn(new Language(['id' => 'hu']));

    $this->configFactory = $this->prophesize(ConfigFactoryInterface::class);

    $this->entityQuery = $this->prophesize(QueryInterface::class);
    $entity_query_factory = $this->prophesize(QueryFactoryInterface::class);
    $entity_query_factory->get($entity_type, 'AND')->willReturn($this->entityQuery->reveal());

    $this->entityStorage = new ConfigEntityStorage($entity_type$this->configFactory->reveal()$this->uuidService->reveal()$this->languageManager->reveal()new MemoryCache());
    $this->entityStorage->setModuleHandler($this->moduleHandler->reveal());

    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
    $entity_type_manager->getDefinition('test_entity_type')->willReturn($entity_type);

    $this->cacheTagsInvalidator = $this->prophesize(CacheTagsInvalidatorInterface::class);

    $typed_config_manager = $this->prophesize(TypedConfigManagerInterface::class);
    $typed_config_manager
      ->getDefinition(Argument::containingString('the_provider.the_config_prefix.'))
      ->willReturn(['mapping' => ['id' => '', 'uuid' => '', 'dependencies' => '']]);

    
Home | Imprint | This part of the site doesn't use cookies.