EntityUuidMapperTest.php in Commerce Core 8.2
File
tests/src/Kernel/EntityUuidMapperTest.php
View source
<?php
namespace Drupal\Tests\commerce\Kernel;
class EntityUuidMapperTest extends CommerceKernelTestBase {
protected $entityUuidMapper;
protected function setUp() : void {
parent::setUp();
$this->entityUuidMapper = $this->container
->get('commerce.entity_uuid_mapper');
}
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);
}
}