本文整理汇总了PHP中Drupal\Core\Entity\EntityTypeManagerInterface::reveal方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityTypeManagerInterface::reveal方法的具体用法?PHP EntityTypeManagerInterface::reveal怎么用?PHP EntityTypeManagerInterface::reveal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityTypeManagerInterface
的用法示例。
在下文中一共展示了EntityTypeManagerInterface::reveal方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
$this->routeProvider = new TestDefaultHtmlRouteProvider($this->entityTypeManager->reveal(), $this->entityFieldManager->reveal());
}
示例2: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->languageManager = $this->prophesize(LanguageManagerInterface::class);
$this->entityRepository = new EntityRepository($this->entityTypeManager->reveal(), $this->languageManager->reveal());
}
示例3: setUp
/**
* {@inheritdoc}
*
* @covers ::__construct
*/
protected function setUp()
{
$this->pageStorage = $this->prophesize(ConfigEntityStorageInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeManager->getStorage('page')->willReturn($this->pageStorage);
$this->cacheTagsInvalidator = $this->prophesize(CacheTagsInvalidatorInterface::class);
$this->routeSubscriber = new PageManagerRoutes($this->entityTypeManager->reveal(), $this->cacheTagsInvalidator->reveal());
}
示例4: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->pageVariantStorage = $this->prophesize(ConfigEntityStorageInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeManager->getStorage('page_variant')->willReturn($this->pageVariantStorage);
$this->currentPath = $this->prophesize(CurrentPathStack::class);
$this->routeFilter = new VariantRouteFilter($this->entityTypeManager->reveal(), $this->currentPath->reveal());
}
示例5: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->keyValueFactory = $this->prophesize(KeyValueFactoryInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
$this->cacheBackend = $this->prophesize(CacheBackendInterface::class);
$this->fieldDefinitionListener = new FieldDefinitionListener($this->entityTypeManager->reveal(), $this->entityFieldManager->reveal(), $this->keyValueFactory->reveal(), $this->cacheBackend->reveal());
}
示例6: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeManager->getDefinitions()->willReturn([$this->entityTypeId => '']);
$this->processPlugin = new LinkUri([], 'link_uri', [], $this->entityTypeManager->reveal());
// Url::fromInternalUri() accesses the path validator from the global
// container.
// @see \Drupal\Core\Url::fromInternalUri()
$this->pathValidator = $this->prophesize(PathValidator::class);
$container = new ContainerBuilder();
$container->set('path.validator', $this->pathValidator->reveal());
\Drupal::setContainer($container);
}
示例7: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeRepository = $this->prophesize(EntityTypeRepositoryInterface::class);
$this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
$this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
$container = new ContainerBuilder();
$container->set('entity_type.manager', $this->entityTypeManager->reveal());
$container->set('entity_type.repository', $this->entityTypeRepository->reveal());
$container->set('entity_type.bundle.info', $this->entityTypeBundleInfo->reveal());
$container->set('entity_field.manager', $this->entityFieldManager->reveal());
$this->entityManager = new EntityManager();
$this->entityManager->setContainer($container);
}
示例8: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$container = new ContainerBuilder();
// Register plugin managers used by Rules, but mock some unwanted
// dependencies requiring more stuff to loaded.
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
// Set all the modules as being existent.
$this->enabledModules = new \ArrayObject();
$this->enabledModules['rules'] = TRUE;
$this->enabledModules['rules_test'] = TRUE;
$enabled_modules = $this->enabledModules;
$this->moduleHandler->moduleExists(Argument::type('string'))->will(function ($arguments) use($enabled_modules) {
return [$arguments[0], $enabled_modules[$arguments[0]]];
});
// Wed don't care about alter() calls on the module handler.
$this->moduleHandler->alter(Argument::any(), Argument::any(), Argument::any(), Argument::any())->willReturn(NULL);
$this->cacheBackend = new NullBackend('rules');
$rules_directory = __DIR__ . '/../../..';
$this->namespaces = new \ArrayObject(['Drupal\\rules' => $rules_directory . '/src', 'Drupal\\rules_test' => $rules_directory . '/tests/modules/rules_test/src', 'Drupal\\Core\\TypedData' => $this->root . '/core/lib/Drupal/Core/TypedData', 'Drupal\\Core\\Validation' => $this->root . '/core/lib/Drupal/Core/Validation']);
$this->actionManager = new RulesActionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
$this->conditionManager = new ConditionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
$this->rulesExpressionManager = new ExpressionManager($this->namespaces, $this->moduleHandler->reveal());
$this->classResolver = $this->prophesize(ClassResolverInterface::class);
$this->typedDataManager = new TypedDataManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal(), $this->classResolver->reveal());
$this->rulesDataProcessorManager = new DataProcessorManager($this->namespaces, $this->moduleHandler->reveal());
$this->aliasManager = $this->prophesize(AliasManagerInterface::class);
// Keep the deprecated entity manager around because it is still used in a
// few places.
$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeManager->getDefinitions()->willReturn([]);
$this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
$this->entityFieldManager->getBaseFieldDefinitions()->willReturn([]);
$this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
$this->entityTypeBundleInfo->getBundleInfo()->willReturn([]);
$this->dataFetcher = new DataFetcher();
$this->dataFilterManager = new DataFilterManager($this->namespaces, $this->moduleHandler->reveal());
$this->placeholderResolver = new PlaceholderResolver($this->dataFetcher, $this->dataFilterManager);
$container->set('entity.manager', $this->entityManager->reveal());
$container->set('entity_type.manager', $this->entityTypeManager->reveal());
$container->set('entity_field.manager', $this->entityFieldManager->reveal());
$container->set('entity_type.bundle.info', $this->entityTypeBundleInfo->reveal());
$container->set('context.repository', new LazyContextRepository($container, []));
$container->set('path.alias_manager', $this->aliasManager->reveal());
$container->set('plugin.manager.rules_action', $this->actionManager);
$container->set('plugin.manager.condition', $this->conditionManager);
$container->set('plugin.manager.rules_expression', $this->rulesExpressionManager);
$container->set('plugin.manager.rules_data_processor', $this->rulesDataProcessorManager);
$container->set('typed_data_manager', $this->typedDataManager);
$container->set('string_translation', $this->getStringTranslationStub());
$container->set('uuid', new Php());
$container->set('typed_data.data_fetcher', $this->dataFetcher);
$container->set('typed_data.placeholder_resolver', $this->placeholderResolver);
\Drupal::setContainer($container);
$this->container = $container;
}
示例9: testAccess
/**
* @covers ::access
*/
public function testAccess()
{
$this->storage->load('id_exists')->willReturn($this->pageVariant->reveal());
$this->storage->load('doesnt_exist')->willReturn(NULL);
$account = $this->prophesize(AccountInterface::class);
$this->pageVariant->access('read', $account->reveal(), TRUE)->willReturn(AccessResult::allowed());
$panels_storage = new PageManagerPanelsStorage([], '', [], $this->entityTypeManager->reveal());
// Test the access condition.
$this->assertEquals(AccessResult::allowed(), $panels_storage->access('id_exists', 'read', $account->reveal()));
// Should be forbidden if it doesn't exist.
$this->assertEquals(AccessResult::forbidden(), $panels_storage->access('doesnt_exist', 'read', $account->reveal()));
}
示例10: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$this->moduleHandler->getImplementations('entity_type_build')->willReturn([]);
$this->moduleHandler->alter('entity_type', Argument::type('array'))->willReturn(NULL);
$this->cacheBackend = $this->prophesize(CacheBackendInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->cacheTagsInvalidator = $this->prophesize(CacheTagsInvalidatorInterface::class);
$language = new Language(['id' => 'en']);
$this->languageManager = $this->prophesize(LanguageManagerInterface::class);
$this->languageManager->getCurrentLanguage()->willReturn($language);
$this->languageManager->getLanguages()->willReturn(['en' => (object) ['id' => 'en']]);
$this->typedDataManager = $this->prophesize(TypedDataManagerInterface::class);
$this->cacheBackend = $this->prophesize(CacheBackendInterface::class);
$container = $this->prophesize(ContainerInterface::class);
$container->get('cache_tags.invalidator')->willReturn($this->cacheTagsInvalidator->reveal());
//$container->get('typed_data_manager')->willReturn($this->typedDataManager->reveal());
\Drupal::setContainer($container->reveal());
$this->entityTypeBundleInfo = new EntityTypeBundleInfo($this->entityTypeManager->reveal(), $this->languageManager->reveal(), $this->moduleHandler->reveal(), $this->typedDataManager->reveal(), $this->cacheBackend->reveal());
}
示例11: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->container = $this->prophesize(ContainerInterface::class);
\Drupal::setContainer($this->container->reveal());
$this->typedDataManager = $this->prophesize(TypedDataManagerInterface::class);
$this->typedDataManager->getDefinition('field_item:boolean')->willReturn(['class' => BooleanItem::class]);
$this->container->get('typed_data_manager')->willReturn($this->typedDataManager->reveal());
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$this->moduleHandler->alter('entity_base_field_info', Argument::type('array'), Argument::any())->willReturn(NULL);
$this->moduleHandler->alter('entity_bundle_field_info', Argument::type('array'), Argument::any(), Argument::type('string'))->willReturn(NULL);
$this->cacheBackend = $this->prophesize(CacheBackendInterface::class);
$this->cacheTagsInvalidator = $this->prophesize(CacheTagsInvalidatorInterface::class);
$language = new Language(['id' => 'en']);
$this->languageManager = $this->prophesize(LanguageManagerInterface::class);
$this->languageManager->getCurrentLanguage()->willReturn($language);
$this->languageManager->getLanguages()->willReturn(['en' => (object) ['id' => 'en']]);
$this->keyValueFactory = $this->prophesize(KeyValueFactoryInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeRepository = $this->prophesize(EntityTypeRepositoryInterface::class);
$this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
$this->entityDisplayRepository = $this->prophesize(EntityDisplayRepositoryInterface::class);
$this->entityFieldManager = new TestEntityFieldManager($this->entityTypeManager->reveal(), $this->entityTypeBundleInfo->reveal(), $this->entityDisplayRepository->reveal(), $this->typedDataManager->reveal(), $this->languageManager->reveal(), $this->keyValueFactory->reveal(), $this->moduleHandler->reveal(), $this->cacheBackend->reveal());
}