本文整理汇总了PHP中Drupal\Core\Extension\ModuleHandlerInterface::reveal方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleHandlerInterface::reveal方法的具体用法?PHP ModuleHandlerInterface::reveal怎么用?PHP ModuleHandlerInterface::reveal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Extension\ModuleHandlerInterface
的用法示例。
在下文中一共展示了ModuleHandlerInterface::reveal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$migration_plugin = $this->prophesize(MigrateProcessInterface::class);
$this->plugin = new BlockVisibility([], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
}
示例2: 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->translationManager = $this->prophesize(TranslationInterface::class);
$this->entityTypeManager = new TestEntityTypeManager(new \ArrayObject(), $this->moduleHandler->reveal(), $this->cacheBackend->reveal(), $this->translationManager->reveal(), $this->getClassResolverStub());
$this->discovery = $this->prophesize(DiscoveryInterface::class);
$this->entityTypeManager->setDiscovery($this->discovery->reveal());
}
示例3: setUp
public function setUp()
{
$this->account = $this->prophesize(AccountInterface::class);
$this->contextHandler = $this->prophesize(ContextHandlerInterface::class);
$this->uuidGenerator = $this->prophesize(UuidInterface::class);
$this->token = $this->prophesize(Token::class);
$this->blockManager = $this->prophesize(BlockManager::class);
$this->conditionManager = $this->prophesize(ConditionManager::class);
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
$this->builderManager = $this->prophesize(DisplayBuilderManagerInterface::class);
$this->layoutManager = $this->prophesize(LayoutPluginManagerInterface::class);
$this->layout = $this->prophesize(LayoutInterface::class);
$this->layoutManager->createInstance(Argument::type('string'), Argument::type('array'))->willReturn($this->layout->reveal());
$this->variant = new PanelsDisplayVariant([], '', [], $this->contextHandler->reveal(), $this->account->reveal(), $this->uuidGenerator->reveal(), $this->token->reveal(), $this->blockManager->reveal(), $this->conditionManager->reveal(), $this->moduleHandler->reveal(), $this->builderManager->reveal(), $this->layoutManager->reveal());
}
示例4: 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->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->typedDataManager = $this->prophesize(TypedDataManager::class);
$this->typedDataManager->getDefinition('field_item:boolean')->willReturn(['class' => BooleanItem::class]);
$this->eventDispatcher = $this->prophesize(EventDispatcherInterface::class);
$this->keyValueFactory = $this->prophesize(KeyValueFactoryInterface::class);
$this->container = $this->prophesize(ContainerInterface::class);
$this->container->get('cache_tags.invalidator')->willReturn($this->cacheTagsInvalidator->reveal());
$this->container->get('typed_data_manager')->willReturn($this->typedDataManager->reveal());
\Drupal::setContainer($this->container->reveal());
$this->discovery = $this->prophesize(DiscoveryInterface::class);
$translation_manager = $this->prophesize(TranslationInterface::class);
$this->entityManager = new TestEntityManager(new \ArrayObject(), $this->moduleHandler->reveal(), $this->cacheBackend->reveal(), $this->languageManager->reveal(), $translation_manager->reveal(), $this->getClassResolverStub(), $this->typedDataManager->reveal(), $this->keyValueFactory->reveal(), $this->eventDispatcher->reveal());
$this->entityManager->setContainer($this->container->reveal());
$this->entityManager->setDiscovery($this->discovery->reveal());
}
示例5: 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());
}
示例6: 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;
$enabledModules = $this->enabledModules;
$this->moduleHandler->moduleExists(Argument::type('string'))->will(function ($arguments) use($enabledModules) {
return [$arguments[0], $enabledModules[$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);
$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->entityManager->getDefinitions()->willReturn([]);
$container->set('entity.manager', $this->entityManager->reveal());
$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());
\Drupal::setContainer($container);
$this->container = $container;
}
示例7: 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());
}
示例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());
$uuid_service = new Php();
$this->rulesExpressionManager = new ExpressionManager($this->namespaces, $this->moduleHandler->reveal(), $uuid_service);
$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([]);
// Setup a rules_component storage mock which returns nothing by default.
$storage = $this->prophesize(ConfigEntityStorageInterface::class);
$storage->loadMultiple(NULL)->willReturn([]);
$this->entityTypeManager->getStorage('rules_component')->willReturn($storage->reveal());
$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', $uuid_service);
$container->set('typed_data.data_fetcher', $this->dataFetcher);
$container->set('typed_data.placeholder_resolver', $this->placeholderResolver);
\Drupal::setContainer($container);
$this->container = $container;
}