mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Implemented TemplateMeta and tests
This commit is contained in:
		@@ -36,7 +36,7 @@ class SourceMetaTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testBasicPath(): void
 | 
			
		||||
    {
 | 
			
		||||
        $subset = ['entity', 'source', 'complex'];
 | 
			
		||||
        $subset = ['source', 'complex'];
 | 
			
		||||
        $amount = count($subset);
 | 
			
		||||
        $basicPathArray = $this->sourceMeta->getBasicPathArray();
 | 
			
		||||
        for ($index = 0; $index < $amount; ++$index) {
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,52 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Tests\Unit\Domain\TemplateManagement;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\TestCase;
 | 
			
		||||
use App\Domain\TemplateManagement\TemplateMetaInterface;
 | 
			
		||||
use App\Entity\Source\Primitive\Name\FirstNameSource;
 | 
			
		||||
use App\Entity\Source\SourceInterface;
 | 
			
		||||
use App\Domain\TemplateManagement\TemplateMeta;
 | 
			
		||||
use App\Domain\SourceManagement\SourceMeta;
 | 
			
		||||
 | 
			
		||||
class TemplateMetaTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var TemplateMetaInterface
 | 
			
		||||
     */
 | 
			
		||||
    protected $templateMeta;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var SourceInterface
 | 
			
		||||
     */
 | 
			
		||||
    protected $source;
 | 
			
		||||
 | 
			
		||||
    private function getExpectedPath(string $type, string $context): string
 | 
			
		||||
    {
 | 
			
		||||
        return $context.'/source/primitive/name/firstname.'.$type.'.twig';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setUp(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->source = new FirstNameSource();
 | 
			
		||||
        $this->templateMeta = new TemplateMeta(new SourceMeta($this->source));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testFrameTemplatePath(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertEquals($this->getExpectedPath('html', 'frame'), $this->templateMeta->getFrameTemplatePath());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testContentTemplatePath(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertEquals($this->getExpectedPath('html', 'content'), $this->templateMeta->getContentTemplatePath());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testSetType(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->templateMeta->setTemplateType('json');
 | 
			
		||||
        $this->assertEquals($this->getExpectedPath('json', 'content'), $this->templateMeta->getContentTemplatePath());
 | 
			
		||||
        $this->assertEquals($this->getExpectedPath('json', 'frame'), $this->templateMeta->getFrameTemplatePath());
 | 
			
		||||
        $this->assertEquals('json', $this->templateMeta->getTemplateType());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user