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

use Ferienpass\CoreBundle\Webhook\PmPaymentNotifyEvent;
use PHPUnit\Framework\TestCase;

final class PmPaymentNotifyEventTest extends TestCase
{
    public function testGetStatusReturnsConstructorStatus(): void
    {
        $event = new PmPaymentNotifyEvent('TX-001', 1, ['foo' => 'bar']);

        self::assertSame(1, $event->getStatus());
    }

    public function testIsSuccessfulReturnsTrueWhenStatusIsOne(): void
    {
        $event = new PmPaymentNotifyEvent('TX-001', 1, []);

        self::assertTrue($event->isSuccessful());
    }

    public function testIsSuccessfulReturnsFalseWhenStatusIsNotOne(): void
    {
        $event = new PmPaymentNotifyEvent('TX-002', 0, []);

        self::assertFalse($event->isSuccessful());
    }

    public function testGetNameReturnsPmPaymentNotify(): void
    {
        $event = new PmPaymentNotifyEvent('TX-003', 1, []);

        self::assertSame('pmPayment.notify', $event->getName());
    }

    public function testGetIdReturnsTxid(): void
    {
        $event = new PmPaymentNotifyEvent('TX-abc', 1, []);

        self::assertSame('TX-abc', $event->getId());
    }
}
