本文整理汇总了PHP中check::fail方法的典型用法代码示例。如果您正苦于以下问题:PHP check::fail方法的具体用法?PHP check::fail怎么用?PHP check::fail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类check
的用法示例。
在下文中一共展示了check::fail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: long_long_equal
function long_long_equal($a, $b, $message)
{
if (!($a === $b)) {
if (!((double) $a === $b)) {
return check::fail($message . ": '{$a}'!=='{$b}'");
}
}
return TRUE;
}
示例2: do_foo
<?php
require "tests.php";
require "director_thread.php";
// No new functions
check::functions(array(millisecondsleep, foo_stop, foo_run, foo_do_foo));
// No new classes
check::classes(array(director_thread, Foo));
// now new vars
check::globals(array(foo_val));
class Derived extends Foo
{
function do_foo()
{
$this->val = $this->val - 1;
}
}
$d = new Derived();
$d->run();
if ($d->val >= 0) {
check::fail($d->val);
}
$d->stop();
check::done();
示例3: virtualMethod
<?php
require "tests.php";
require "director_pass_by_value.php";
$passByVal = null;
class director_pass_by_value_Derived extends DirectorPassByValueAbstractBase
{
function virtualMethod($b)
{
global $passByVal;
$passByVal = $b;
}
}
# bug was the passByVal global object was destroyed after the call to virtualMethod had finished.
$caller = new Caller();
$caller->call_virtualMethod(new director_pass_by_value_Derived());
$ret = $passByVal->getVal();
if ($ret != 0x12345678) {
check::fail("Bad return value, got " . dechex($ret));
}
check::done();
示例4: catch
try {
$bad->call_int();
check::fail("Exception wasn't propagated from Bad::return_int()");
} catch (Exception $e) {
check::equal($e->getMessage(), "bad int", "propagated exception incorrect");
}
try {
$bad->call_double();
check::fail("Exception wasn't propagated from Bad::return_double()");
} catch (Exception $e) {
check::equal($e->getMessage(), "bad double", "propagated exception incorrect");
}
try {
$bad->call_const_char_star();
check::fail("Exception wasn't propagated from Bad::return_const_char_star()");
} catch (Exception $e) {
check::equal($e->getMessage(), "bad const_char_star", "propagated exception incorrect");
}
try {
$bad->call_std_string();
check::fail("Exception wasn't propagated from Bad::return_std_string()");
} catch (Exception $e) {
check::equal($e->getMessage(), "bad std_string", "propagated exception incorrect");
}
try {
$bad->call_Bar();
check::fail("Exception wasn't propagated from Bad::return_Bar()");
} catch (Exception $e) {
check::equal($e->getMessage(), "bad Bar", "propagated exception incorrect");
}
check::done();
示例5: resource
function resource($a, $b, $message)
{
$resource = trim(check::var_dump($a));
if (!eregi("^resource\\([0-9]+\\) of type \\({$b}\\)", $resource)) {
return check::fail($message);
}
return TRUE;
}