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

use Ferienpass\CoreBundle\Entity\Offer\OfferInterface;
use Ferienpass\CoreBundle\Entity\Participant\ParticipantInterface;
use Ferienpass\CoreBundle\Payments\OfferFeeEvent;
use PHPUnit\Framework\TestCase;

final class OfferFeeEventTest extends TestCase
{
    public function testGetFee(): void
    {
        $event = new OfferFeeEvent(1500, $this->createMock(OfferInterface::class), $this->createMock(ParticipantInterface::class));

        self::assertSame(1500, $event->getFee());
    }

    public function testGetFeeNullReturnsZero(): void
    {
        $event = new OfferFeeEvent(null, $this->createMock(OfferInterface::class), $this->createMock(ParticipantInterface::class));

        self::assertSame(0, $event->getFee());
    }

    public function testGetOffer(): void
    {
        $offer = $this->createMock(OfferInterface::class);
        $event = new OfferFeeEvent(0, $offer, $this->createMock(ParticipantInterface::class));

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

    public function testGetParticipant(): void
    {
        $participant = $this->createMock(ParticipantInterface::class);
        $event = new OfferFeeEvent(0, $this->createMock(OfferInterface::class), $participant);

        self::assertSame($participant, $event->getParticipant());
    }

    public function testSetFee(): void
    {
        $event = new OfferFeeEvent(100, $this->createMock(OfferInterface::class), $this->createMock(ParticipantInterface::class));
        $event->setFee(999);

        self::assertSame(999, $event->getFee());
    }
}
