
| Current Path : /var/www/html/store/web/modules/contrib/commerce/tests/src/Kernel/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/store/web/modules/contrib/commerce/tests/src/Kernel/EntityUuidMapperTest.php |
<?php
namespace Drupal\Tests\commerce\Kernel;
/**
* Tests the EntityUuidMapper class.
*
* @coversDefaultClass \Drupal\commerce\EntityUuidMapper
* @group commerce
*/
class EntityUuidMapperTest extends CommerceKernelTestBase {
/**
* The entity UUID mapper.
*
* @var \Drupal\commerce\EntityUuidMapperInterface
*/
protected $entityUuidMapper;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->entityUuidMapper = $this->container->get('commerce.entity_uuid_mapper');
}
/**
* Tests the mapper.
*
* @covers ::mapToIds
* @covers ::mapFromIds
*/
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);
}
}