mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Renamed domain FormManagement to Form
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user