2019-01-26 20:22:17 +01:00
|
|
|
<?php
|
|
|
|
|
2019-05-30 16:13:29 +02:00
|
|
|
namespace tests\Unit\Domain\Form;
|
2019-01-26 20:22:17 +01:00
|
|
|
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\DBAL\Types\ActionType;
|
2019-05-30 16:13:29 +02:00
|
|
|
use Infinito\Domain\Form\FormClassNameService;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Source\PureSource;
|
2020-04-02 21:13:35 +02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-01-26 20:22:17 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class FormClassNameServiceTest extends TestCase
|
|
|
|
{
|
2019-02-03 15:40:44 +01:00
|
|
|
public function testGetName(): void
|
2019-01-26 20:22:17 +01:00
|
|
|
{
|
2019-02-03 15:21:45 +01:00
|
|
|
$entityClass = PureSource::class;
|
2019-01-26 20:22:17 +01:00
|
|
|
$formNameService = new FormClassNameService();
|
2019-02-03 15:21:45 +01:00
|
|
|
$entityForm = $formNameService->getClass($entityClass);
|
2019-04-13 20:12:32 +02:00
|
|
|
$this->assertEquals('Infinito\\Form\\Entity\\Source\\PureSourceType', $entityForm);
|
2019-01-26 20:22:17 +01:00
|
|
|
}
|
2019-02-03 15:40:44 +01:00
|
|
|
|
|
|
|
public function testWithType(): void
|
|
|
|
{
|
|
|
|
$entityClass = PureSource::class;
|
|
|
|
$formNameService = new FormClassNameService();
|
|
|
|
$entityForm = $formNameService->getClass($entityClass, ActionType::CREATE);
|
2019-04-13 20:12:32 +02:00
|
|
|
$this->assertEquals('Infinito\\Form\\Entity\\Source\\PureSourceCreateType', $entityForm);
|
2019-02-03 15:40:44 +01:00
|
|
|
}
|
2019-01-26 20:22:17 +01:00
|
|
|
}
|