summaryrefslogtreecommitdiff
path: root/tests/units/Core/TemplateTest.php
blob: 9833397b308bcf073d70ad814276d4a9fb19d0ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

require_once __DIR__.'/../Base.php';

use Core\Template;

class TemplateTest extends Base
{
    public function testGetTemplateFile()
    {
        $t = new Template($this->container);
        $this->assertStringEndsWith('app/Core/../Template/a/b.php', $t->getTemplateFile('a/b'));
    }

    public function testGetPluginTemplateFile()
    {
        $t = new Template($this->container);
        $this->assertStringEndsWith('app/Core/../../plugins/Myplugin/Template/a/b.php', $t->getTemplateFile('myplugin:a/b'));
    }

    public function testGetOverridedTemplateFile()
    {
        $t = new Template($this->container);
        $t->setTemplateOverride('a/b', 'myplugin:c');
        $this->assertStringEndsWith('app/Core/../../plugins/Myplugin/Template/c.php', $t->getTemplateFile('a/b'));
        $this->assertStringEndsWith('app/Core/../Template/d.php', $t->getTemplateFile('d'));
    }
}