示例#1
0
文件: test.php 项目: kch42/ste
<?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");
示例#2
0
 public function test_global_expectation_is_cleared_by_finish_spying()
 {
     $spy = \Spies\get_spy_for('test_func');
     \Spies\expect_spy($spy)->to_have_been_called->with('first call');
     test_func('first call');
     \Spies\finish_spying();
     $spy = \Spies\get_spy_for('test_func');
     \Spies\expect_spy($spy)->not->to_have_been_called->with('first call');
 }
示例#3
0
<?php

function test_func(&$arg1)
{
    var_dump($arg1);
    return "hello";
}
$tst = array(0 => "element1", "a" => "element2");
$a = test_func($tst);
echo "{$a} world";
示例#4
0
文件: test001.php 项目: brosner/pyphp
<?php

echo test_func();
echo 6 + 9;
echo 5 * 6;
示例#5
0
function task()
{
    echo "do some local jobs \n";
    sleep(1);
    $data = "task";
    echo "do IO jobs need send data to server\n";
    $res = (yield new SystemCall(test_func((yield new SystemCall(test_func($data))))));
    sleep(1);
    // echo "get server response ".print_r($res,true) . "\n";
    // sleep(1);
    // $res = (yield new SystemCall(test_func($res)));
    echo "get server response " . print_r($res, true) . "\n";
}