You are here

private function PurchasableEntityTypeRepositoryTest::createMockedDefinitions in Commerce Core 8.2

Creates mocked entity type definitions.

Parameters

array $definition_items: The definition items.

Return value

array The mocked definitions.

3 calls to PurchasableEntityTypeRepositoryTest::createMockedDefinitions()
PurchasableEntityTypeRepositoryTest::testGetDefaultPurchasableEntityType in tests/src/Unit/PurchasableEntityTypeRepositoryTest.php
@covers ::getDefaultPurchasableEntityType
PurchasableEntityTypeRepositoryTest::testGetPurchasableEntityTypeLabels in tests/src/Unit/PurchasableEntityTypeRepositoryTest.php
@covers ::getPurchasableEntityTypeLabels
PurchasableEntityTypeRepositoryTest::testGetPurchasableEntityTypes in tests/src/Unit/PurchasableEntityTypeRepositoryTest.php
@covers ::getPurchasableEntityTypes

File

tests/src/Unit/PurchasableEntityTypeRepositoryTest.php, line 157

Class

PurchasableEntityTypeRepositoryTest
@coversDefaultClass \Drupal\commerce\PurchasableEntityTypeRepository @group commerce

Namespace

Drupal\Tests\commerce\Unit

Code

private function createMockedDefinitions(array $definition_items) : array {
  $definitions = [];
  foreach ($definition_items as $entity_type_id => $data) {
    $mock = $this
      ->prophesize(EntityTypeInterface::class);
    $mock
      ->entityClassImplements(PurchasableEntityInterface::class)
      ->willReturn($data['is_purchasable']);
    $mock
      ->getLabel()
      ->willReturn($data['label']);
    $definitions[$entity_type_id] = $mock
      ->reveal();
  }
  return $definitions;
}