本文整理匯總了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;
}