infinito/application/symfony/tests/Unit/Domain/Form/RequestedActionFormBuilderTest.php
2019-05-30 16:13:29 +02:00

28 lines
1.0 KiB
PHP

<?php
namespace tests\Unit\Domain\Form;
use PHPUnit\Framework\TestCase;
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
use Infinito\Domain\Form\RequestedActionFormBuilder;
use Infinito\Domain\Form\FormClassNameServiceInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Infinito\Exception\Attribut\UndefinedAttributException;
/**
* @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);
$this->expectException(UndefinedAttributException::class);
$requestedActionFormBuilder->create($requestedAction);
}
}