<?php

declare(strict_types=1);

namespace Ferienpass\AdminBundle\Tests\Form\Event;

use Ferienpass\AdminBundle\Form\Event\SubmitEvent;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;

final class SubmitEventTest extends TestCase
{
    public function testGetFormReturnsForm(): void
    {
        $form = $this->createStub(FormInterface::class);
        $request = new Request();
        $event = new SubmitEvent($form, $request);

        self::assertSame($form, $event->getForm());
    }

    public function testGetRequestReturnsRequest(): void
    {
        $form = $this->createStub(FormInterface::class);
        $request = new Request();
        $event = new SubmitEvent($form, $request);

        self::assertSame($request, $event->getRequest());
    }

    public function testGetDataDelegatesToForm(): void
    {
        $form = $this->createMock(FormInterface::class);
        $form->method('getData')->willReturn(['key' => 'value']);
        $event = new SubmitEvent($form, new Request());

        self::assertSame(['key' => 'value'], $event->getData());
    }
}
