You are here

public function AmountTest::testCreate in Currency 8.3

@covers ::create @covers ::__construct

File

tests/src/Unit/Plugin/views/field/AmountTest.php, line 148

Class

AmountTest
@coversDefaultClass \Drupal\currency\Plugin\views\field\Amount

Namespace

Drupal\Tests\currency\Unit\Plugin\views\field

Code

public 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 = [
    [
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ],
    [
      'module_handler',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->moduleHandler,
    ],
    [
      'renderer',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->renderer,
    ],
    [
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $sut = Amount::create($container, [], '', $this->pluginDefinition);
  $this
    ->assertInstanceOf(Amount::class, $sut);
}