You are here

public function CurrencyExchangeTest::setUp in Currency 8.3

Overrides UnitTestCase::setUp

File

tests/src/Unit/Plugin/Filter/CurrencyExchangeTest.php, line 69

Class

CurrencyExchangeTest
@coversDefaultClass \Drupal\currency\Plugin\Filter\CurrencyExchange

Namespace

Drupal\Tests\currency\Unit\Plugin\Filter

Code

public function setUp() : void {
  $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->exchangeRateProvider = $this
    ->createMock(ExchangeRateProviderInterface::class);
  $this->input = $this
    ->createMock(InputInterface::class);
  $this->stringTranslation = $this
    ->getStringTranslationStub();
  $container = new Container();
  $container
    ->set('cache_contexts_manager', $this->cacheContextsManager);
  \Drupal::setContainer($container);
  $this->sut = new CurrencyExchange($configuration, $plugin_id, $this->pluginDefinition, $this->stringTranslation, $this->exchangeRateProvider, $this->input);
}