41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Events;
|
|
|
|
use Domain\Events\BrandCreated;
|
|
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(BrandCreated::class);
|
|
|
|
describe('BrandCreated Domain Event Unit Tests', function (): void {
|
|
it('holds correct event data upon instantiation', function (): void {
|
|
// GIVEN
|
|
$brandId = new BrandId(Uuid::uuid7());
|
|
$brandName = new BrandName('Duc');
|
|
$brandCode = new BrandCode('DUC01');
|
|
$arcadiaId = new ArcadiaId('42');
|
|
$now = new \DateTimeImmutable();
|
|
|
|
// WHEN
|
|
$event = new BrandCreated(
|
|
brandId: $brandId,
|
|
brandName: $brandName,
|
|
brandCode: $brandCode,
|
|
arcadiaId: $arcadiaId,
|
|
occurredAt: $now,
|
|
);
|
|
|
|
// THEN
|
|
expect($event->brandId)->toBe($brandId)
|
|
->and($event->brandName)->toBe($brandName)
|
|
->and($event->brandCode)->toBe($brandCode)
|
|
->and($event->arcadiaId)->toBe($arcadiaId)
|
|
->and($event->occurredAt)->toBe($now);
|
|
});
|
|
});
|