infinito/application/symfony/tests/Unit/Domain/Form/RequestedActionFormBuilderTest.php

28 lines
1.0 KiB
PHP
Raw Permalink Normal View History

<?php
2019-05-30 16:13:29 +02:00
namespace tests\Unit\Domain\Form;
2019-05-30 16:13:29 +02:00
use Infinito\Domain\Form\FormClassNameServiceInterface;
2020-04-02 21:13:35 +02:00
use Infinito\Domain\Form\RequestedActionFormBuilder;
use Infinito\Domain\Request\Action\RequestedActionInterface;
2019-04-15 01:37:17 +02:00
use Infinito\Exception\Attribut\UndefinedAttributException;
2020-04-02 21:13:35 +02:00
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormFactoryInterface;
/**
* @author kevinfrantz
*/
class RequestedActionFormBuilderTest extends TestCase
{
public function testRequestedActionNotValid(): void
{
$requestedAction = $this->createMock(RequestedActionInterface::class);
$requestedAction->method('hasRequestedEntity')->willReturn(false);
$formFactory = $this->createMock(FormFactoryInterface::class);
$formClassNameService = $this->createMock(FormClassNameServiceInterface::class);
$requestedActionFormBuilder = new RequestedActionFormBuilder($formFactory, $formClassNameService);
2019-04-15 01:37:17 +02:00
$this->expectException(UndefinedAttributException::class);
$requestedActionFormBuilder->create($requestedAction);
}
}