mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 06:27:24 +01:00
Solved last template implementation bugs
This commit is contained in:
parent
3ab9cb0e99
commit
70fb25e936
@ -57,7 +57,7 @@ class EntityMetaInformation implements EntityMetaInformationInterface
|
|||||||
{
|
{
|
||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
$this->entityReflection = new \ReflectionClass($entity);
|
$this->entityReflection = new \ReflectionClass($entity);
|
||||||
$this->setBasicPathArray();
|
$this->setNamespacePathMap();
|
||||||
$this->setPureName();
|
$this->setPureName();
|
||||||
$this->setInterfaceReflection();
|
$this->setInterfaceReflection();
|
||||||
$this->setTemplatePathFormAndView();
|
$this->setTemplatePathFormAndView();
|
||||||
@ -66,10 +66,10 @@ class EntityMetaInformation implements EntityMetaInformationInterface
|
|||||||
|
|
||||||
private function setTemplatePathFormAndView(): void
|
private function setTemplatePathFormAndView(): void
|
||||||
{
|
{
|
||||||
$this->templatePathFormAndView = new TemplatePathFormAndView($this->namespacePathMap->getPath(), $this->pureName);
|
$this->templatePathFormAndView = new TemplatePathFormAndView($this->pureName, $this->namespacePathMap->getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setBasicPathArray(): void
|
private function setNamespacePathMap(): void
|
||||||
{
|
{
|
||||||
$namespace = $this->entityReflection->getNamespaceName();
|
$namespace = $this->entityReflection->getNamespaceName();
|
||||||
$namespaceWithoutRoot = str_replace('App\\Entity\\', '', $namespace);
|
$namespaceWithoutRoot = str_replace('App\\Entity\\', '', $namespace);
|
||||||
|
@ -17,11 +17,6 @@ final class FormMetaInformation implements FormMetaInformationInterface
|
|||||||
*/
|
*/
|
||||||
private $entityMetaInformation;
|
private $entityMetaInformation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var TemplatePathInformationInterface
|
|
||||||
*/
|
|
||||||
private $templatePathInformation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -33,7 +28,6 @@ final class FormMetaInformation implements FormMetaInformationInterface
|
|||||||
public function __construct(EntityMetaInformationInterface $entityMetaInformation)
|
public function __construct(EntityMetaInformationInterface $entityMetaInformation)
|
||||||
{
|
{
|
||||||
$this->entityMetaInformation = $entityMetaInformation;
|
$this->entityMetaInformation = $entityMetaInformation;
|
||||||
$this->setTemplateMetaInformation();
|
|
||||||
$this->setFormClass();
|
$this->setFormClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +40,6 @@ final class FormMetaInformation implements FormMetaInformationInterface
|
|||||||
$this->formClass .= '\\'.ucfirst($this->entityMetaInformation->getPureName()).'Type';
|
$this->formClass .= '\\'.ucfirst($this->entityMetaInformation->getPureName()).'Type';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setTemplateMetaInformation(): void
|
|
||||||
{
|
|
||||||
$this->templatePathInformation = $this->entityMetaInformation->getTemplatePathFormAndView()->getForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
@ -68,6 +57,6 @@ final class FormMetaInformation implements FormMetaInformationInterface
|
|||||||
*/
|
*/
|
||||||
public function getTemplatePathInformation(): TemplatePathInformationInterface
|
public function getTemplatePathInformation(): TemplatePathInformationInterface
|
||||||
{
|
{
|
||||||
return $this->templatePathInformation;
|
return $this->entityMetaInformation->getTemplatePathFormAndView()->getForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,12 @@ use App\Domain\TemplateManagement\TemplatePathInformationInterface;
|
|||||||
*/
|
*/
|
||||||
class FormMetaInformationTest extends TestCase
|
class FormMetaInformationTest extends TestCase
|
||||||
{
|
{
|
||||||
|
const FORM_CLASS = 'App\Form\Source\Primitive\Name\SurnameType';
|
||||||
|
|
||||||
|
const FORM_VIEW_ATOM = 'atom/form/source/primitive/name/surname.html.twig';
|
||||||
|
|
||||||
|
const FORM_VIEW_MOLECULE = 'molecule/form/source/primitive/name/surname.html.twig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FormMetaInformationInterface
|
* @var FormMetaInformationInterface
|
||||||
*/
|
*/
|
||||||
@ -27,7 +33,13 @@ class FormMetaInformationTest extends TestCase
|
|||||||
|
|
||||||
public function testGetFormClass(): void
|
public function testGetFormClass(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals('App\Form\Source\Primitive\Name\SurnameType', $this->formMeta->getFormClass());
|
$this->assertEquals(self::FORM_CLASS, $this->formMeta->getFormClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetView(): void
|
||||||
|
{
|
||||||
|
$this->assertEquals(self::FORM_VIEW_ATOM, $this->formMeta->getTemplatePathInformation()->getAtomTemplatePath());
|
||||||
|
$this->assertEquals(self::FORM_VIEW_MOLECULE, $this->formMeta->getTemplatePathInformation()->getMoleculeTemplatePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTemplateMeta(): void
|
public function testTemplateMeta(): void
|
||||||
|
@ -15,15 +15,20 @@ use App\Exception\NotCorrectInstanceException;
|
|||||||
|
|
||||||
class SourceMetaInformationTest extends TestCase
|
class SourceMetaInformationTest extends TestCase
|
||||||
{
|
{
|
||||||
|
const FOLDERS = [
|
||||||
|
'source',
|
||||||
|
'complex',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SourceMetaInformationInterface
|
* @var SourceMetaInformationInterface
|
||||||
*/
|
*/
|
||||||
protected $sourceMetaInformation;
|
private $sourceMetaInformation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SourceInterface
|
* @var SourceInterface
|
||||||
*/
|
*/
|
||||||
protected $source;
|
private $source;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
@ -37,16 +42,15 @@ class SourceMetaInformationTest extends TestCase
|
|||||||
$this->assertNotEquals('user2', $this->sourceMetaInformation->getPureName());
|
$this->assertNotEquals('user2', $this->sourceMetaInformation->getPureName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBasicPath(): void
|
public function testFolders(): void
|
||||||
{
|
{
|
||||||
$subset = ['source', 'complex'];
|
$amount = count(self::FOLDERS);
|
||||||
$amount = count($subset);
|
$folders = $this->sourceMetaInformation->getNamespacePathMap()->getFolders();
|
||||||
$basicPathArray = $this->sourceMetaInformation->getNamespacePathMap()->getFolders();
|
|
||||||
for ($index = 0; $index < $amount; ++$index) {
|
for ($index = 0; $index < $amount; ++$index) {
|
||||||
$this->assertEquals($subset[$index], $basicPathArray[$index]);
|
$this->assertEquals(self::FOLDERS[$index], $folders[$index]);
|
||||||
}
|
}
|
||||||
$this->assertArraySubset($subset, $basicPathArray);
|
$this->assertArraySubset(self::FOLDERS, $folders);
|
||||||
$this->assertEquals($amount, count($basicPathArray));
|
$this->assertEquals($amount, count($folders));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInterfaceReflection(): void
|
public function testInterfaceReflection(): void
|
||||||
|
Loading…
Reference in New Issue
Block a user