Step 05 — Hardening

- 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
This commit is contained in:
2026-03-04 00:35:20 +01:00
parent 129ea58dae
commit b356033f7b
15 changed files with 257 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
<?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'));
}
}