You are here

function CurrencyListBuilderTest::testCreateInstance in Currency 8.3

@covers ::createInstance @covers ::__construct

File

tests/src/Unit/Entity/Currency/CurrencyListBuilderTest.php, line 76

Class

CurrencyListBuilderTest
@coversDefaultClass \Drupal\currency\Entity\Currency\CurrencyListBuilder

Namespace

Drupal\Tests\currency\Unit\Entity\Currency

Code

function testCreateInstance() {
  $entity_type_manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->expects($this
    ->once())
    ->method('getStorage')
    ->with('currency')
    ->willReturn($this->entityStorage);
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = array(
    array(
      'entity_type.manager',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $entity_type_manager,
    ),
    array(
      'module_handler',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->moduleHandler,
    ),
    array(
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ),
  );
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);
  $sut = CurrencyListBuilder::createInstance($container, $this->entityType);
  $this
    ->assertInstanceOf(CurrencyListBuilder::class, $sut);
}