<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CoreBundle\Tests\Messenger;

use Ferienpass\CoreBundle\Messenger\LocaleStamp;
use Ferienpass\CoreBundle\Messenger\UuidStamp;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Uid\Uuid;

final class StampsTest extends TestCase
{
    public function testLocaleStampGetLocale(): void
    {
        $stamp = new LocaleStamp('de');

        self::assertSame('de', $stamp->getLocale());
    }

    public function testUuidStampGeneratesUuidByDefault(): void
    {
        $stamp = new UuidStamp();

        self::assertInstanceOf(Uuid::class, $stamp->getUuid());
    }

    public function testUuidStampAcceptsUuidObject(): void
    {
        $uuid = Uuid::v7();
        $stamp = new UuidStamp($uuid);

        self::assertSame($uuid->toRfc4122(), $stamp->getUuid()->toRfc4122());
    }

    public function testUuidStampAcceptsStringUuid(): void
    {
        $uuid = Uuid::v7();
        $stamp = new UuidStamp($uuid->toRfc4122());

        self::assertSame($uuid->toRfc4122(), $stamp->getUuid()->toRfc4122());
    }
}
