/** * {@inheritdoc} */ public function setUp() { parent::setUp(); $this->cacheContextsManager = $this->getMockBuilder(CacheContextsManager::class)->disableOriginalConstructor()->getMock(); $this->cacheContextsManager->expects($this->any())->method('assertValidTokens')->willReturn(TRUE); $container = new Container(); $container->set('cache_contexts_manager', $this->cacheContextsManager); \Drupal::setContainer($container); $this->entityType = $this->getMock(EntityTypeInterface::class); $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class); $this->sut = new CurrencyAccessControlHandler($this->entityType, $this->moduleHandler); }
/** * {@inheritdoc} */ public function setUp() { $configuration = []; $plugin_id = $this->randomMachineName(); $this->pluginDefinition = ['cache' => TRUE, 'provider' => $this->randomMachineName()]; $this->cacheContextsManager = $this->getMockBuilder(CacheContextsManager::class)->disableOriginalConstructor()->getMock(); $this->cacheContextsManager->expects($this->any())->method('assertValidTokens')->willReturn(TRUE); $this->currencyStorage = $this->getMock(EntityStorageInterface::class); $this->input = $this->getMock(InputInterface::class); $this->stringTranslation = $this->getStringTranslationStub(); $container = new Container(); $container->set('cache_contexts_manager', $this->cacheContextsManager); \Drupal::setContainer($container); $this->sut = new CurrencyLocalize($configuration, $plugin_id, $this->pluginDefinition, $this->stringTranslation, $this->currencyStorage, $this->input); }