<?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\DbafsMedia;
use Ferienpass\CoreBundle\Entity\Offer\Base;
use Ferienpass\CoreBundle\Entity\OfferMedia;
use PHPUnit\Framework\TestCase;

final class OfferMediaTest extends TestCase
{
    public function testConstructWithOffer(): void
    {
        $offer = new Base();
        $media = new OfferMedia(offer: $offer);

        self::assertSame($offer, $media->getOffer());
    }

    public function testSetOffer(): void
    {
        $offer = new Base();
        $media = new OfferMedia();
        $media->setOffer($offer);

        self::assertSame($offer, $media->getOffer());
    }

    public function testGetSortingDefaultsToZero(): void
    {
        $media = new OfferMedia();

        self::assertSame(0, $media->getSorting());
    }

    public function testSetSorting(): void
    {
        $media = new OfferMedia();
        $media->setSorting(5);

        self::assertSame(5, $media->getSorting());
    }

    public function testConstructWithDbafsMedia(): void
    {
        $dbafsMedia = new DbafsMedia();
        $media = new OfferMedia(media: $dbafsMedia);

        self::assertSame($dbafsMedia, $media->getMedia());
    }

    public function testSetMedia(): void
    {
        $dbafsMedia = new DbafsMedia();
        $media = new OfferMedia();
        $media->setMedia($dbafsMedia);

        self::assertSame($dbafsMedia, $media->getMedia());
    }
}
