summaryrefslogtreecommitdiff
path: root/tests/test.php
blob: f051d94ac6952b84aa2fae25604ae83fd745cda7 (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
30
31
<?php

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

use \kch42\ste;

$ste_initializer = function($sa) {
	return new ste\STECore($sa);
};

require("code.php");

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 = $ste_initializer(new TestStorage());
$ste->mute_runtime_errors = false;
test_func($ste);
echo $ste->exectemplate("test.tpl");