You are here

function FixedRatesFormTest::testCreate in Currency 8.3

Same name in this branch
  1. 8.3 tests/src/Unit/Controller/FixedRatesFormTest.php \Drupal\Tests\currency\Unit\Controller\FixedRatesFormTest::testCreate()
  2. 8.3 tests/src/Unit/Form/FixedRatesFormTest.php \Drupal\Tests\currency\Unit\Form\FixedRatesFormTest::testCreate()

@covers ::create @covers ::__construct

File

tests/src/Unit/Form/FixedRatesFormTest.php, line 100

Class

FixedRatesFormTest
@coversDefaultClass \Drupal\currency\Form\FixedRatesForm

Namespace

Drupal\Tests\currency\Unit\Form

Code

function testCreate() {
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->expects($this
    ->once())
    ->method('getStorage')
    ->with('currency')
    ->willReturn($this->currencyStorage);
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'config.factory',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->configFactory,
    ),
    array(
      'currency.form_helper',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->formHelper,
    ),
    array(
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ),
    array(
      'plugin.manager.currency.exchange_rate_provider',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->currencyExchangeRateProviderManager,
    ),
    array(
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $sut = FixedRatesForm::create($container);
  $this
    ->assertInstanceOf(FixedRatesForm::class, $sut);
}