Renamed domain FormManagement to Form

This commit is contained in:
Kevin Frantz
2019-05-30 16:13:29 +02:00
parent 8307016460
commit 145b093e7c
16 changed files with 25 additions and 25 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace tests\Unit\Domain\Form;
use PHPUnit\Framework\TestCase;
use Infinito\Domain\Form\FormClassNameService;
use Infinito\Entity\Source\PureSource;
use Infinito\DBAL\Types\ActionType;
/**
* @author kevinfrantz
*/
class FormClassNameServiceTest extends TestCase
{
public function testGetName(): void
{
$entityClass = PureSource::class;
$formNameService = new FormClassNameService();
$entityForm = $formNameService->getClass($entityClass);
$this->assertEquals('Infinito\\Form\\Entity\\Source\\PureSourceType', $entityForm);
}
public function testWithType(): void
{
$entityClass = PureSource::class;
$formNameService = new FormClassNameService();
$entityForm = $formNameService->getClass($entityClass, ActionType::CREATE);
$this->assertEquals('Infinito\\Form\\Entity\\Source\\PureSourceCreateType', $entityForm);
}
}

View File

@@ -0,0 +1,27 @@
<?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);
}
}