本文整理汇总了PHP中Drupal\Core\Language\LanguageManagerInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManagerInterface::expects方法的具体用法?PHP LanguageManagerInterface::expects怎么用?PHP LanguageManagerInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Language\LanguageManagerInterface
的用法示例。
在下文中一共展示了LanguageManagerInterface::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->aliasProcessor = $this->getMockBuilder('Drupal\Core\PathProcessor\PathProcessorAlias')
->disableOriginalConstructor()
->getMock();
$this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->languageManager->expects($this->any())
->method('getCurrentLanguage')
->willReturn(new Language(Language::$defaultValues));
$this->pathValidator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
$this->subPathautoSettings = $this->getMock('Drupal\Core\Config\ConfigBase');
$this->configFactory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
$this->configFactory->expects($this->any())
->method('get')
->with('subpathauto.settings')
->willReturn($this->subPathautoSettings);
$this->sut = new PathProcessor($this->aliasProcessor, $this->languageManager, $this->configFactory);
$this->sut->setPathValidator($this->pathValidator);
}
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->cacheBackend = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
$this->getContainerWithCacheBins($this->cacheBackend);
$configs = array();
$configs['views.settings']['skip_cache'] = FALSE;
$this->configFactory = $this->getConfigFactoryStub($configs);
$this->moduleHandler = $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->languageManager = $this->getMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getCurrentLanguage')->will($this->returnValue(new Language(array('id' => 'en'))));
$this->viewsData = new ViewsData($this->cacheBackend, $this->configFactory, $this->moduleHandler, $this->languageManager);
}
示例3: setup
/**
* {@inheritdoc}
*/
public function setup()
{
$this->defaultDateTime = $this->getMockBuilder(DrupalDateTime::class)->disableOriginalConstructor()->getMock();
$language = $this->getMock(LanguageInterface::class);
$this->languageManager = $this->getMock(LanguageManagerInterface::class);
$this->languageManager->expects($this->any())->method('getCurrentLanguage')->willReturn($language);
$this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
$this->paymentStatusManager = $this->getMock(PaymentStatusManagerInterface::class);
$configuration = [];
$this->pluginId = $this->randomMachineName();
$this->pluginDefinition = array('label' => $this->randomMachineName());
$this->sut = $this->getMockBuilder(PaymentStatusBase::class)->setConstructorArgs(array($configuration, $this->pluginId, $this->pluginDefinition, $this->moduleHandler, $this->paymentStatusManager, $this->defaultDateTime))->getMockForAbstractClass();
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->mailManager = $this->getMock('\\Drupal\\Core\\Mail\\MailManagerInterface');
$this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$this->logger = $this->getMock('\\Psr\\Log\\LoggerInterface');
$this->entityManager = $this->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
$this->userStorage = $this->getMock('\\Drupal\\Core\\Entity\\EntityStorageInterface');
$this->entityManager->expects($this->any())->method('getStorage')->with('user')->willReturn($this->userStorage);
$string_translation = $this->getStringTranslationStub();
$this->contactMailHandler = new MailHandler($this->mailManager, $this->languageManager, $this->logger, $string_translation, $this->entityManager);
$language = new Language(array('id' => 'en'));
$this->languageManager->expects($this->any())->method('getDefaultLanguage')->will($this->returnValue($language));
$this->languageManager->expects($this->any())->method('getCurrentLanguage')->will($this->returnValue($language));
}
示例5: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->id = $this->randomMachineName();
$values = array('id' => $this->id, 'langcode' => 'en', 'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a');
$this->entityTypeId = $this->randomMachineName();
$this->provider = $this->randomMachineName();
$this->entityType = $this->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$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())->method('getDefinition')->with($this->entityTypeId)->will($this->returnValue($this->entityType));
$this->uuid = $this->getMock('\\Drupal\\Component\\Uuid\\UuidInterface');
$this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getLanguage')->with('en')->will($this->returnValue(new Language(array('id' => 'en'))));
$this->cacheBackend = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
$this->typedConfigManager = $this->getMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('uuid', $this->uuid);
$container->set('language_manager', $this->languageManager);
$container->set('cache.test', $this->cacheBackend);
$container->set('config.typed', $this->typedConfigManager);
$container->setParameter('cache_bins', array('cache.test' => 'test'));
\Drupal::setContainer($container);
$this->entity = $this->getMockForAbstractClass('\\Drupal\\Core\\Config\\Entity\\ConfigEntityBase', array($values, $this->entityTypeId));
}
示例6: testBuildTreeWithoutParameters
/**
* Tests buildTree with simple menu_name and no parameters.
*/
public function testBuildTreeWithoutParameters()
{
$language = new Language(array('id' => 'en'));
$this->languageManager->expects($this->any())->method('getCurrentLanguage')->will($this->returnValue($language));
// Setup query and the query result.
$query = $this->getMock('Drupal\\Core\\Entity\\Query\\QueryInterface');
$this->entityQueryFactory->expects($this->once())->method('get')->with('menu_link')->will($this->returnValue($query));
$query->expects($this->once())->method('condition')->with('menu_name', 'test_menu');
$query->expects($this->once())->method('execute')->will($this->returnValue(array(1, 2, 3)));
$storage = $this->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
$base = array('access' => TRUE, 'weight' => 0, 'title' => 'title');
$menu_link = $base + array('mlid' => 1, 'p1' => 3, 'p2' => 2, 'p3' => 1);
$links[1] = $menu_link;
$menu_link = $base + array('mlid' => 3, 'p1' => 3, 'depth' => 1);
$links[3] = $menu_link;
$menu_link = $base + array('mlid' => 2, 'p1' => 3, 'p2' => 2, 'depth' => 2);
$links[2] = $menu_link;
$storage->expects($this->once())->method('loadMultiple')->with(array(1, 2, 3))->will($this->returnValue($links));
$this->menuTree->setStorage($storage);
// Ensure that static/non static caching works.
// First setup no working caching.
$this->cacheBackend->expects($this->at(0))->method('get')->with('links:test_menu:tree-data:en:35786c7117b4e38d0f169239752ce71158266ae2f6e4aa230fbbb87bd699c0e3')->will($this->returnValue(FALSE));
$this->cacheBackend->expects($this->at(1))->method('set')->with('links:test_menu:tree-data:en:35786c7117b4e38d0f169239752ce71158266ae2f6e4aa230fbbb87bd699c0e3', $this->anything(), Cache::PERMANENT, array('menu' => 'test_menu'));
// Ensure that the static caching triggered.
$this->cacheBackend->expects($this->exactly(1))->method('get');
$this->menuTree->buildTree('test_menu');
$this->menuTree->buildTree('test_menu');
}
示例7: setUp
/**
* {@inheritdoc}
*
* @covers ::__construct()
*/
protected function setUp()
{
parent::setUp();
$this->entityType = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
$this->entityTypeId = 'test_entity_type';
$this->entityType->expects($this->any())->method('getKey')->will($this->returnValueMap(array(array('id', 'id'), array('uuid', 'uuid'))));
$this->entityType->expects($this->any())->method('id')->will($this->returnValue($this->entityTypeId));
$this->entityType->expects($this->any())->method('getConfigPrefix')->will($this->returnValue('the_config_prefix'));
$this->entityType->expects($this->any())->method('getClass')->will($this->returnValue(get_class($this->getMockEntity())));
$this->entityType->expects($this->any())->method('getListCacheTags')->willReturn(array('test_entity_type_list'));
$this->moduleHandler = $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->uuidService = $this->getMock('Drupal\\Component\\Uuid\\UuidInterface');
$this->languageManager = $this->getMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getDefaultLanguage')->will($this->returnValue(new Language(array('langcode' => 'en'))));
$this->configFactory = $this->getMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
$this->entityQuery = $this->getMock('Drupal\\Core\\Entity\\Query\\QueryInterface');
$this->entityStorage = $this->getMockBuilder('Drupal\\Core\\Config\\Entity\\ConfigEntityStorage')->setConstructorArgs(array($this->entityType, $this->configFactory, $this->uuidService, $this->languageManager))->setMethods(array('getQuery'))->getMock();
$this->entityStorage->expects($this->any())->method('getQuery')->will($this->returnValue($this->entityQuery));
$this->entityStorage->setModuleHandler($this->moduleHandler);
$this->entityManager = $this->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
$this->entityManager->expects($this->any())->method('getDefinition')->with('test_entity_type')->will($this->returnValue($this->entityType));
$this->cacheBackend = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
$this->typedConfigManager = $this->getMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
$this->typedConfigManager->expects($this->any())->method('getDefinition')->will($this->returnValue(array('mapping' => array('id' => '', 'uuid' => '', 'dependencies' => ''))));
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('config.typed', $this->typedConfigManager);
$container->set('cache.test', $this->cacheBackend);
$container->setParameter('cache_bins', array('cache.test' => 'test'));
\Drupal::setContainer($container);
}
示例8: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
$this->id = 1;
$values = array('id' => $this->id, 'langcode' => 'en', 'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a');
$this->entityTypeId = $this->randomName();
$this->bundle = $this->randomName();
$this->entityType = $this->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$this->entityType->expects($this->any())->method('getKeys')->will($this->returnValue(array('id' => 'id', 'uuid' => 'uuid')));
$this->entityManager = $this->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
$this->entityManager->expects($this->any())->method('getDefinition')->with($this->entityTypeId)->will($this->returnValue($this->entityType));
$this->uuid = $this->getMock('\\Drupal\\Component\\Uuid\\UuidInterface');
$this->typedDataManager = $this->getMockBuilder('\\Drupal\\Core\\TypedData\\TypedDataManager')->disableOriginalConstructor()->getMock();
$language = new Language(array('id' => 'en'));
$this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getLanguages')->will($this->returnValue(array('en' => $language)));
$this->languageManager->expects($this->any())->method('getLanguage')->with('en')->will($this->returnValue($language));
$this->fieldTypePluginManager = $this->getMockBuilder('\\Drupal\\Core\\Field\\FieldTypePluginManager')->disableOriginalConstructor()->getMock();
$this->fieldTypePluginManager->expects($this->any())->method('getDefaultSettings')->will($this->returnValue(array()));
$this->fieldTypePluginManager->expects($this->any())->method('getDefaultInstanceSettings')->will($this->returnValue(array()));
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('uuid', $this->uuid);
$container->set('typed_data_manager', $this->typedDataManager);
$container->set('language_manager', $this->languageManager);
$container->set('plugin.manager.field.field_type', $this->fieldTypePluginManager);
\Drupal::setContainer($container);
$this->fieldDefinitions = array('id' => FieldDefinition::create('integer'), 'revision_id' => FieldDefinition::create('integer'));
$this->entityManager->expects($this->any())->method('getFieldDefinitions')->with($this->entityTypeId, $this->bundle)->will($this->returnValue($this->fieldDefinitions));
$this->entity = $this->getMockForAbstractClass('\\Drupal\\Core\\Entity\\ContentEntityBase', array($values, $this->entityTypeId, $this->bundle));
}
示例9: testGetInfo
/**
* @covers ::getInfo
*/
public function testGetInfo()
{
$token_info = array('types' => array('foo' => array('name' => $this->randomMachineName())));
$this->language->expects($this->atLeastOnce())->method('getId')->will($this->returnValue($this->randomMachineName()));
$this->languageManager->expects($this->once())->method('getCurrentLanguage')->with(LanguageInterface::TYPE_CONTENT)->will($this->returnValue($this->language));
// The persistent cache must only be hit once, after which the info is
// cached statically.
$this->cache->expects($this->once())->method('get');
$this->cache->expects($this->once())->method('set')->with('token_info:' . $this->language->getId(), $token_info);
$this->moduleHandler->expects($this->once())->method('invokeAll')->with('token_info')->will($this->returnValue($token_info));
$this->moduleHandler->expects($this->once())->method('alter')->with('token_info', $token_info);
// Get the information for the first time. The cache should be checked, the
// hooks invoked, and the info should be set to the cache should.
$this->token->getInfo();
// Get the information for the second time. The data must be returned from
// the static cache, so the persistent cache must not be accessed and the
// hooks must not be invoked.
$this->token->getInfo();
}
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->values = array('id' => 1, 'langcode' => 'en', 'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a');
$this->entityTypeId = $this->randomMachineName();
$this->entityType = $this->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$this->entityType->expects($this->any())->method('getListCacheTags')->willReturn(array($this->entityTypeId . '_list'));
$this->entityManager = $this->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
$this->entityManager->expects($this->any())->method('getDefinition')->with($this->entityTypeId)->will($this->returnValue($this->entityType));
$this->uuid = $this->getMock('\\Drupal\\Component\\Uuid\\UuidInterface');
$this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getLanguage')->with('en')->will($this->returnValue(new Language(array('id' => 'en'))));
$this->cacheTagsInvalidator = $this->getMock('Drupal\\Core\\Cache\\CacheTagsInvalidator');
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('uuid', $this->uuid);
$container->set('language_manager', $this->languageManager);
$container->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
\Drupal::setContainer($container);
$this->entity = $this->getMockForAbstractClass('\\Drupal\\Core\\Entity\\Entity', array($this->values, $this->entityTypeId));
}
示例11: testToLink
/**
* Tests for the Entity::toLink() method
*
* @covers ::toLink
*
* @dataProvider providerTestLink
*/
public function testToLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = [])
{
$language = new Language(['id' => 'es']);
$link_options += ['language' => $language];
$this->languageManager->expects($this->any())->method('getLanguage')->with('es')->willReturn($language);
$route_name_map = ['canonical' => 'entity.test_entity_type.canonical', 'edit-form' => 'entity.test_entity_type.edit_form'];
$route_name = $route_name_map[$link_rel];
$entity_id = 'test_entity_id';
$entity_type_id = 'test_entity_type';
$expected = '<a href="/test_entity_type/test_entity_id">' . $expected_text . '</a>';
$entity_type = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
$entity_type->expects($this->once())->method('getLinkTemplates')->willReturn($route_name_map);
$entity_type->expects($this->any())->method('getKey')->willReturnMap([['label', 'label'], ['langcode', 'langcode']]);
$this->entityManager->expects($this->any())->method('getDefinition')->with($entity_type_id)->will($this->returnValue($entity_type));
/** @var \Drupal\Core\Entity\Entity $entity */
$entity = $this->getMockForAbstractClass('Drupal\\Core\\Entity\\Entity', [['id' => $entity_id, 'label' => $entity_label, 'langcode' => 'es'], $entity_type_id]);
$expected_link = Link::createFromRoute($expected_text, $route_name, [$entity_type_id => $entity_id], ['entity_type' => $entity_type_id, 'entity' => $entity] + $link_options);
$result_link = $entity->toLink($link_text, $link_rel, $link_options);
$this->assertEquals($expected_link, $result_link);
}
示例12: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->libraryDiscovery = $this->getMockBuilder('Drupal\\Core\\Asset\\LibraryDiscovery')->disableOriginalConstructor()->getMock();
$this->libraryDependencyResolver = $this->getMock('\\Drupal\\Core\\Asset\\LibraryDependencyResolverInterface');
$this->libraryDependencyResolver->expects($this->any())->method('getLibrariesWithDependencies')->willReturnArgument(0);
$this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->themeManager = $this->getMock('\\Drupal\\Core\\Theme\\ThemeManagerInterface');
$active_theme = $this->getMockBuilder('\\Drupal\\Core\\Theme\\ActiveTheme')->disableOriginalConstructor()->getMock();
$active_theme->expects($this->any())->method('getName')->willReturn('bartik');
$this->themeManager->expects($this->any())->method('getActiveTheme')->willReturn($active_theme);
$this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$english = $this->getMock('\\Drupal\\Core\\Language\\LanguageInterface');
$english->expects($this->any())->method('getId')->willReturn('en');
$japanese = $this->getMock('\\Drupal\\Core\\Language\\LanguageInterface');
$japanese->expects($this->any())->method('getId')->willReturn('jp');
$this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getCurrentLanguage')->will($this->onConsecutiveCalls($english, $english, $japanese, $japanese));
$this->cache = new TestMemoryBackend('llama');
$this->assetResolver = new AssetResolver($this->libraryDiscovery, $this->libraryDependencyResolver, $this->moduleHandler, $this->themeManager, $this->languageManager, $this->cache);
}
示例13: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->entityType = $this->getMock('Drupal\\Core\\Entity\\ContentEntityTypeInterface');
$this->entityType->expects($this->any())->method('id')->will($this->returnValue($this->entityTypeId));
$this->container = new ContainerBuilder();
\Drupal::setContainer($this->container);
$this->entityManager = $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
$this->moduleHandler = $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->cache = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
$this->languageManager = $this->getMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getDefaultLanguage')->will($this->returnValue(new Language(array('langcode' => 'en'))));
$this->connection = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')->disableOriginalConstructor()->getMock();
}
示例14: testgetExtraFields
/**
* @covers ::getExtraFields
*/
function testgetExtraFields()
{
$this->setUpEntityManager();
$entity_type_id = $this->randomMachineName();
$bundle = $this->randomMachineName();
$language_code = 'en';
$hook_bundle_extra_fields = array($entity_type_id => array($bundle => array('form' => array('foo_extra_field' => array('label' => 'Foo')))));
$processed_hook_bundle_extra_fields = $hook_bundle_extra_fields;
$processed_hook_bundle_extra_fields[$entity_type_id][$bundle] += array('display' => array());
$cache_id = 'entity_bundle_extra_fields:' . $entity_type_id . ':' . $bundle . ':' . $language_code;
$language = new Language(array('id' => $language_code));
$this->languageManager->expects($this->once())->method('getCurrentLanguage')->will($this->returnValue($language));
$this->cacheBackend->expects($this->once())->method('get')->with($cache_id);
$this->moduleHandler->expects($this->once())->method('invokeAll')->with('entity_extra_field_info')->will($this->returnValue($hook_bundle_extra_fields));
$this->moduleHandler->expects($this->once())->method('alter')->with('entity_extra_field_info', $hook_bundle_extra_fields);
$this->cacheBackend->expects($this->once())->method('set')->with($cache_id, $processed_hook_bundle_extra_fields[$entity_type_id][$bundle]);
$this->assertSame($processed_hook_bundle_extra_fields[$entity_type_id][$bundle], $this->entityManager->getExtraFields($entity_type_id, $bundle));
}
示例15: setUpKeyValueEntityStorage
/**
* Prepares the key value entity storage.
*
* @covers ::__construct()
*
* @param string $uuid_key
* (optional) The entity key used for the UUID. Defaults to 'uuid'.
*/
protected function setUpKeyValueEntityStorage($uuid_key = 'uuid')
{
$this->entityType->expects($this->atLeastOnce())->method('getKey')->will($this->returnValueMap(array(array('id', 'id'), array('uuid', $uuid_key))));
$this->entityType->expects($this->atLeastOnce())->method('id')->will($this->returnValue('test_entity_type'));
$this->entityManager = $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
$this->entityManager->expects($this->any())->method('getDefinition')->with('test_entity_type')->will($this->returnValue($this->entityType));
$this->cacheBackend = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
$this->keyValueStore = $this->getMock('Drupal\\Core\\KeyValueStore\\KeyValueStoreInterface');
$this->moduleHandler = $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->uuidService = $this->getMock('Drupal\\Component\\Uuid\\UuidInterface');
$this->languageManager = $this->getMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager->expects($this->any())->method('getDefaultLanguage')->will($this->returnValue(new Language(array('langcode' => 'en'))));
$this->entityStorage = new KeyValueEntityStorage($this->entityType, $this->keyValueStore, $this->uuidService, $this->languageManager);
$this->entityStorage->setModuleHandler($this->moduleHandler);
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
$container->set('language_manager', $this->languageManager);
$container->set('cache.test', $this->cacheBackend);
$container->setParameter('cache_bins', array('cache.test' => 'test'));
\Drupal::setContainer($container);
}