44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Events;
|
|
|
|
use Domain\Events\BrandRenamed;
|
|
use Domain\Models\ValueObjects\Brand\ArcadiaId;
|
|
use Domain\Models\ValueObjects\Brand\BrandCode;
|
|
use Domain\Models\ValueObjects\Brand\BrandId;
|
|
use Domain\Models\ValueObjects\Brand\BrandName;
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
covers(BrandRenamed::class);
|
|
|
|
describe('BrandRenamed Domain Event Unit Tests', function (): void {
|
|
it('holds correct event data upon instantiation', function (): void {
|
|
// GIVEN
|
|
$brandId = new BrandId(Uuid::uuid7());
|
|
$oldName = new BrandName('Le Gaulois');
|
|
$newName = new BrandName('Le Gaulois France');
|
|
$brandCode = new BrandCode('LGL01');
|
|
$arcadiaId = new ArcadiaId('1');
|
|
$now = new \DateTimeImmutable();
|
|
|
|
// WHEN
|
|
$event = new BrandRenamed(
|
|
brandId: $brandId,
|
|
oldName: $oldName,
|
|
newName: $newName,
|
|
brandCode: $brandCode,
|
|
arcadiaId: $arcadiaId,
|
|
occurredAt: $now,
|
|
);
|
|
|
|
// THEN
|
|
expect($event->brandId)->toBe($brandId)
|
|
->and($event->oldName)->toBe($oldName)
|
|
->and($event->newName)->toBe($newName)
|
|
->and($event->brandCode)->toBe($brandCode)
|
|
->and($event->arcadiaId)->toBe($arcadiaId)
|
|
->and($event->occurredAt)->toBe($now);
|
|
});
|
|
});
|