Solved last template implementation bugs

This commit is contained in:
Kevin Frantz
2019-01-06 16:26:46 +01:00
parent 3ab9cb0e99
commit 70fb25e936
4 changed files with 30 additions and 25 deletions

View File

@@ -14,6 +14,12 @@ use App\Domain\TemplateManagement\TemplatePathInformationInterface;
*/
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
*/
@@ -27,7 +33,13 @@ class FormMetaInformationTest extends TestCase
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

View File

@@ -15,15 +15,20 @@ use App\Exception\NotCorrectInstanceException;
class SourceMetaInformationTest extends TestCase
{
const FOLDERS = [
'source',
'complex',
];
/**
* @var SourceMetaInformationInterface
*/
protected $sourceMetaInformation;
private $sourceMetaInformation;
/**
* @var SourceInterface
*/
protected $source;
private $source;
public function setUp(): void
{
@@ -37,16 +42,15 @@ class SourceMetaInformationTest extends TestCase
$this->assertNotEquals('user2', $this->sourceMetaInformation->getPureName());
}
public function testBasicPath(): void
public function testFolders(): void
{
$subset = ['source', 'complex'];
$amount = count($subset);
$basicPathArray = $this->sourceMetaInformation->getNamespacePathMap()->getFolders();
$amount = count(self::FOLDERS);
$folders = $this->sourceMetaInformation->getNamespacePathMap()->getFolders();
for ($index = 0; $index < $amount; ++$index) {
$this->assertEquals($subset[$index], $basicPathArray[$index]);
$this->assertEquals(self::FOLDERS[$index], $folders[$index]);
}
$this->assertArraySubset($subset, $basicPathArray);
$this->assertEquals($amount, count($basicPathArray));
$this->assertArraySubset(self::FOLDERS, $folders);
$this->assertEquals($amount, count($folders));
}
public function testInterfaceReflection(): void