You are here

function FixedRatesOverviewTest::testCreate in Currency 8.3

@covers ::create @covers ::__construct

File

tests/src/Unit/Controller/FixedRatesOverviewTest.php, line 87

Class

FixedRatesOverviewTest
@coversDefaultClass \Drupal\currency\Controller\FixedRatesOverview

Namespace

Drupal\Tests\currency\Unit\Controller

Code

function testCreate() {
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->expects($this
    ->atLeastOnce())
    ->method('getStorage')
    ->with('currency')
    ->willReturn($this->currencyStorage);
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ),
    array(
      'plugin.manager.currency.amount_formatter',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->currencyAmountFormatterManager,
    ),
    array(
      'plugin.manager.currency.exchange_rate_provider',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->currencyExchangeRateProviderManager,
    ),
    array(
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ),
    array(
      'url_generator',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->urlGenerator,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $sut = FixedRatesOverview::create($container);
  $this
    ->assertInstanceOf(FixedRatesOverview::class, $sut);
}