- CorrelationId VO pour le tracing inter-BC - IdempotencyStore (interface + InMemory) pour garde d'idempotence - correlationId ajouté aux contrats Published Language (retro-compatible par défaut) - Consumers Invoicing et LegacyFulfillment idempotents avec logging - MessengerSalesEventPublisher propage les correlationIds - Tests unitaires idempotence + tests d'intégration consommateurs idempotents
37 lines
829 B
PHP
37 lines
829 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MiniShop\Tests\Unit\Shared;
|
|
|
|
use MiniShop\Shared\Technical\InMemoryIdempotencyStore;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class IdempotencyTest extends TestCase
|
|
{
|
|
public function test_first_call_is_not_duplicate(): void
|
|
{
|
|
$store = new InMemoryIdempotencyStore();
|
|
|
|
self::assertFalse($store->isDuplicate('key-1'));
|
|
}
|
|
|
|
public function test_second_call_is_duplicate(): void
|
|
{
|
|
$store = new InMemoryIdempotencyStore();
|
|
|
|
$store->isDuplicate('key-1');
|
|
|
|
self::assertTrue($store->isDuplicate('key-1'));
|
|
}
|
|
|
|
public function test_different_keys_are_independent(): void
|
|
{
|
|
$store = new InMemoryIdempotencyStore();
|
|
|
|
$store->isDuplicate('key-1');
|
|
|
|
self::assertFalse($store->isDuplicate('key-2'));
|
|
}
|
|
}
|