/** * {@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()); }
/** * {@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()); }
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()); }
/** * {@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()); }
/** * {@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()); }
/** * {@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; }
/** * {@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()); }
/** * {@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; }