2019-02-15 16:55:49 +01:00
|
|
|
<?php
|
|
|
|
|
2019-05-30 17:07:11 +02:00
|
|
|
namespace tests\Unit\Domain\Template;
|
2019-02-15 16:55:49 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-05-30 17:07:11 +02:00
|
|
|
use Infinito\Domain\Template\TemplateNameServiceInterface;
|
|
|
|
use Infinito\Domain\Template\TemplateNameService;
|
2019-05-30 16:52:02 +02:00
|
|
|
use Infinito\Domain\Request\Entity\RequestedEntityServiceInterface;
|
|
|
|
use Infinito\Domain\Request\Action\RequestedActionServiceInterface;
|
2019-02-15 16:55:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class TemplateNameServiceTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var TemplateNameServiceInterface
|
|
|
|
*/
|
|
|
|
private $templateNameService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2019-02-17 14:33:19 +01:00
|
|
|
const CLASS_NAME = 'Infinito\\Entity\\Source\\PureSource';
|
2019-02-15 16:55:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
const ACTION_TYPE = 'CREATE';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
const EXPECTED_MOLECULE_TEMPLATE_NAME = 'entity/source/pure_source_create.html.twig';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
const EXPECTED_ATOM_TEMPLATE_NAME = 'entity/source/_pure_source_create.html.twig';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
|
|
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
|
|
|
*/
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$requestedEntityService = $this->createMock(RequestedEntityServiceInterface::class);
|
|
|
|
$requestedEntityService->method('getClass')->willReturn(self::CLASS_NAME);
|
|
|
|
$requestedActionService = $this->createMock(RequestedActionServiceInterface::class);
|
|
|
|
$requestedActionService->method('getRequestedEntity')->willReturn($requestedEntityService);
|
|
|
|
$requestedActionService->method('getActionType')->willReturn(self::ACTION_TYPE);
|
|
|
|
$this->templateNameService = new TemplateNameService($requestedActionService);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetMoleculeName(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals(self::EXPECTED_MOLECULE_TEMPLATE_NAME, $this->templateNameService->getMoleculeTemplateName());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetAtomName(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals(self::EXPECTED_ATOM_TEMPLATE_NAME, $this->templateNameService->getAtomTemplateName());
|
|
|
|
}
|
|
|
|
}
|