<?php

namespace App\Tests\Entity;

use App\Entity\Contrats;
use App\Entity\ContratsPayments;
use PHPUnit\Framework\TestCase;

class ContratsPaymentsTest extends TestCase
{
    public function testGettersAndSetters()
    {
        $payment = new ContratsPayments();
        $contrat = new Contrats();
        $now = new \DateTimeImmutable();
        $validateAt = $now->modify('+1 day');

        $payment->setContrat($contrat);
        $payment->setPaymentAt($now);
        $payment->setType('caution');
        $payment->setAmount(100.0);
        $payment->setState('complete');
        $payment->setPaymentId('pay_123');
        $payment->setValidateAt($validateAt);
        $payment->setCard(['last4' => '4242']);
        $payment->setUpdateAt($now);

        $this->assertSame($contrat, $payment->getContrat());
        $this->assertSame($now, $payment->getPaymentAt());
        $this->assertEquals('caution', $payment->getType());
        $this->assertEquals(100.0, $payment->getAmount());
        $this->assertEquals('complete', $payment->getState());
        $this->assertEquals('pay_123', $payment->getPaymentId());
        $this->assertSame($validateAt, $payment->getValidateAt());
        $this->assertEquals(['last4' => '4242'], $payment->getCard());
        $this->assertSame($now, $payment->getUpdateAt());
    }
}
