summaryrefslogtreecommitdiff
path: root/tests/test.php
blob: 15453b0794e5a4210764d75b4cb0e604675fe6b3 (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
29
<?php

require(dirname(__FILE__) . "/../steloader.php");
require("code.php");

use \kch42\ste;

class TestStorage implements ste\StorageAccess
{
    public function load($tpl, &$mode)
    {
        $mode = ste\StorageAccess::MODE_SOURCE;
        return file_get_contents($tpl);
    }

    public function save($tpl, $data, $mode)
    {
        if ($mode != ste\StorageAccess::MODE_TRANSCOMPILED) {
            return;
        }

        file_put_contents("$tpl.transc.php", $data);
    }
}

$ste = new ste\STECore(new TestStorage());
$ste->mute_runtime_errors = false;
test_func($ste);
echo $ste->exectemplate("test.tpl");