Configure l'environnement de développement complet avec Docker Compose, structure DDD 4 Bounded Contexts, et pipeline CI/CD GitHub Actions. Corrections compatibilité CI: - Symfony 8 nécessite monolog-bundle ^4.0 (la v3.x ne supporte que jusqu'à Symfony 7) - ESLint v9 nécessite flat config (eslint.config.js) - le format .eslintrc.cjs est obsolète
52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Unit\Shared\Domain;
|
|
|
|
use App\Shared\Domain\CorrelationId;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
final class CorrelationIdTest extends TestCase
|
|
{
|
|
public function testGenerateCreatesValidUuid(): void
|
|
{
|
|
$correlationId = CorrelationId::generate();
|
|
|
|
$this->assertTrue(Uuid::isValid($correlationId->value()));
|
|
}
|
|
|
|
public function testFromStringCreatesCorrelationIdFromValidUuid(): void
|
|
{
|
|
$uuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
$correlationId = CorrelationId::fromString($uuid);
|
|
|
|
$this->assertSame($uuid, $correlationId->value());
|
|
}
|
|
|
|
public function testValueReturnsUuidString(): void
|
|
{
|
|
$uuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
$correlationId = CorrelationId::fromString($uuid);
|
|
|
|
$this->assertSame($uuid, $correlationId->value());
|
|
}
|
|
|
|
public function testToStringReturnsUuidString(): void
|
|
{
|
|
$uuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
$correlationId = CorrelationId::fromString($uuid);
|
|
|
|
$this->assertSame($uuid, (string) $correlationId);
|
|
}
|
|
|
|
public function testGenerateCreatesDifferentIdsEachTime(): void
|
|
{
|
|
$id1 = CorrelationId::generate();
|
|
$id2 = CorrelationId::generate();
|
|
|
|
$this->assertNotSame($id1->value(), $id2->value());
|
|
}
|
|
}
|