<?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\Entity;

use Ferienpass\CoreBundle\Entity\DbafsLogo;
use Ferienpass\CoreBundle\Entity\User;
use PHPUnit\Framework\TestCase;

final class DbafsLogoTest extends TestCase
{
    public function testGetCreatedAtIsSetOnConstruct(): void
    {
        $logo = new DbafsLogo();

        self::assertInstanceOf(\DateTimeInterface::class, $logo->getCreatedAt());
    }

    public function testGetUuidNullByDefault(): void
    {
        $logo = new DbafsLogo();

        self::assertNull($logo->getUuid());
    }

    public function testGetHostsInitiallyEmpty(): void
    {
        $logo = new DbafsLogo();

        self::assertCount(0, $logo->getHosts());
    }

    public function testSetCreatedAt(): void
    {
        $logo = new DbafsLogo();
        $dt = new \DateTimeImmutable('2024-03-15');
        $logo->setCreatedAt($dt);

        self::assertSame($dt, $logo->getCreatedAt());
    }

    public function testGetUploadedByNullByDefault(): void
    {
        $logo = new DbafsLogo();

        self::assertNull($logo->getUploadedBy());
    }

    public function testSetUploadedBy(): void
    {
        $logo = new DbafsLogo();
        $user = new User();
        $logo->setUploadedBy($user);

        self::assertSame($user, $logo->getUploadedBy());
    }

    public function testSetLastModified(): void
    {
        $logo = new DbafsLogo();
        $logo->setLastModified(1700000000);

        self::assertInstanceOf(\DateTimeInterface::class, $logo->getLastModified());
    }
}
