本文整理匯總了PHP中Test::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP Test::run方法的具體用法?PHP Test::run怎麽用?PHP Test::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Test
的用法示例。
在下文中一共展示了Test::run方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run()
{
$this->result = $this->ping->run();
if ($this->result > $this->config['max']) {
$this->error = 'Maximum ping reached: ' . $this->result . '/' . $this->config['max'];
}
return parent::run();
}
示例2: run
2. No stopping execution before Test::run()
3. No Exceptions or PHP errors / warnings notices allowed
4. No redefining $test
Hints:
1. Caesar
2. Magic methods
3. Requires a new feature of PHP 5.4
*/
class Test
{
private $secret = 'Nyy lbhe Onfr ner orybat gb hf.';
private $callback;
public final function run()
{
call_user_func($this->callback);
return $this->secret . PHP_EOL;
}
public function __set($k, $v)
{
$key = $v[$v[$v]];
// $v is some kind of weird array
$value = $v();
// and a callback!
$this->{$key} = $value;
}
}
$test = new Test();
// start editing here
// end editing here
echo $test->run();
示例3: error_reporting
<?php
// run
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
$file = $_POST['file'];
$test = $_POST['test'];
ob_start();
$test = Test::run($file, $test);
$output = ob_get_clean();
echo json_encode(array('pass' => $test, 'output' => $output));
示例4: run
<?php
/**
* @author ryan<zer0131@vip.qq.com>
* @desc 測試腳本
*/
set_time_limit(0);
require __DIR__ . DIRECTORY_SEPARATOR . 'loader.php';
class Test
{
public function run()
{
echo \Service\Service::test() . PHP_EOL;
}
}
$test = new Test();
$test->run();
示例5: run
<?php
// Require php compile with ZTS and PECL pthreads
class Test extends Thread
{
public function run()
{
while (true) {
echo $this->getCurrentThreadId();
sleep(1);
}
}
}
$t = new Test();
$t->run();
示例6: array_diff_key
<pre>$ g++ -Wall -pedantic -o main main.cpp
$ ./main
Hello, world!</pre>
Congratulations! You've just run your first C++ program.
<?php
$args = array_diff_key($_GET, array('debug' => '', 'style' => ''));
$args = array_keys($args);
$tests = empty($args) ? array() : explode(',', implode(',', $args));
if (!empty($tests)) {
echo '<p>Showing only test(s) <strong>' . implode(', ', $tests) . '</strong>.</p>';
}
hyperlight_test('python');
hyperlight_test('csharp');
hyperlight_test('VB');
hyperlight_test('simple.css', 'css');
hyperlight_test('../' . basename(__FILE__), 'php');
hyperlight_test('preg_helper.php', 'php');
hyperlight_test('pizzachili_api.h', 'cpp');
hyperlight_test('XML');
hyperlight_test('style.css', 'css');
?>
<h2>Test runs</h2>
<?php
require 'tests.php';
?>
<pre><?php
Test::run('PregMerge');
?>
</pre><?php
write_epilog();
}
示例7: create
}
//乘法和除法類似省略...
//實例化計算機對象的工廠類
class Factory
{
public static function create($operate)
{
return new $operate();
}
}
//測試終端類
class Test
{
function run()
{
//10+20=30
$operate = Factory::create('Jia');
$operate->a = 10;
$operate->b = 20;
echo $operate->getRes() . "\n";
//100-20=80
$operate = Factory::create('Jian');
$operate->a = 100;
$operate->b = 20;
echo $operate->getRes() . "\n";
}
}
//調用測試
$a = new Test();
$a->run();
示例8: run
<?php
class Test
{
public function run()
{
$r = $this->my_parse_m();
var_dump($r);
return $r;
}
public function my_parse_m()
{
$test = true;
if ($test === true) {
$a = 'b';
} else {
return false;
}
// flush();
return true;
}
}
$t = new Test();
var_dump($t->run());
示例9: load_config
}
static function load_config()
{
$time = time();
$config = (include ROOT_PATH . DS . 'config.php');
foreach ($config as $id => $task) {
// 先支持秒(, *) 這兩種
$ret = ParseCrontab::parse($task["time"], $time);
// 設置每秒的任務
foreach ($ret as $sec) {
self::$turntable[$sec][$id] = $task;
}
}
}
static function do_something($interval)
{
// 在執行獲取任務的時候,隻獲取當前秒的任務
$tasks_arr = self::$turntable;
$current_sec = intval(date('s'));
if (!isset($tasks_arr[$current_sec])) {
return false;
}
$tasks = $tasks_arr[$current_sec];
foreach ($tasks as $id => $task) {
(new Process())->create_process($task);
}
return true;
}
}
Test::run();
示例10: index
public function index()
{
Test::run();
}
示例11: array
$template->parse("\n {foreach \$number in \$numbers}{echo \$number_i},{echo \$number},{/foreach}");
$processed = $template->process(array("numbers" => array(1, 2, 3)));
return trim($processed) == "0,1,1,2,2,3,";
}, "Template parses foreach tag", "Template");
Test::add(function () use($template) {
$template->parse("\n {for \$number in \$numbers}{echo \$number_i},{echo \$number},{/for}\n ");
$processed = $template->process(array("numbers" => array(1, 2, 3)));
return trim($processed) == "0,1,1,2,2,3,";
}, "Template parses for tag", "Template");
Test::add(function () use($template) {
$template->parse("\n {if \$check == \"yes\"}yes{/if}\n {elseif \$check == \"maybe\"}yes{/elseif}\n {else}yes{/else}\n ");
$yes = $template->process(array("check" => "yes"));
$maybe = $template->process(array("check" => "maybe"));
$no = $template->process(array("check" => null));
return $yes == $maybe && $maybe == $no;
}, "Template parses if, else and elseif tags", "Template");
Test::add(function () use($template) {
$template->parse("\n {macro foo(\$number)}\n {echo \$number + 2}\n {/macro}\n\n {echo foo(2)}\n ");
$processed = $template->process();
return $processed == 4;
}, "Template parses macro tag", "Template");
Test::add(function () use($template) {
$template->parse("\n {literal}\n {echo \"hello world\"}\n {/literal}\n ");
$processed = $template->process();
return trim($processed) == "{echo \"hello world\"}";
}, "Template parses literal tag", "Template");
//////////////////////////////
$tests = Test::run();
echo '<pre>';
print_r($tests);
echo '</pre>';