You are here

public function EntityUuidMapperTest::testMapper in Commerce Core 8.2

Tests the mapper.

@covers ::mapToIds @covers ::mapFromIds

File

tests/src/Kernel/EntityUuidMapperTest.php, line 35

Class

EntityUuidMapperTest
Tests the EntityUuidMapper class.

Namespace

Drupal\Tests\commerce\Kernel

Code

public function testMapper() {
  $another_store = $this
    ->createStore('Second store', 'second@example.com');
  $map = [
    $this->store
      ->id() => $this->store
      ->uuid(),
    $another_store
      ->id() => $another_store
      ->uuid(),
  ];
  $uuid_map = $this->entityUuidMapper
    ->mapToIds('commerce_store', array_values($map));
  $this
    ->assertEquals($uuid_map, array_flip($map));
  $id_map = $this->entityUuidMapper
    ->mapFromIds('commerce_store', array_keys($map));
  $this
    ->assertEquals($id_map, $map);
}