本文整理汇总了PHP中SimpleTestCase::assertTrue方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTestCase::assertTrue方法的具体用法?PHP SimpleTestCase::assertTrue怎么用?PHP SimpleTestCase::assertTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTestCase
的用法示例。
在下文中一共展示了SimpleTestCase::assertTrue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertType
/**
* Tests the type of a value.
* @param $value Value to take type of.
* @param $type Hoped for type.
* @param $message Message to display.
* @public
*/
function assertType($value, $type, $message = "%s")
{
parent::assertTrue(gettype($value) == strtolower($type), $message);
}
示例2:
/**
* Triggers an assertion on the held test case.
* Should be overridden when using another test
* framework other than the SimpleTest one if the
* assertion method has a different name.
* @param boolean $assertion True will pass.
* @param string $message Message that will go with
* the test event.
* @param SimpleTestCase $test Unit test case to send
* assertion to.
* @access protected
*/
function _assertTrue($assertion, $message , &$test) {
if ($test) {
$test->assertTrue($assertion, $message);
}
}
示例3: assert
/**
* Sends pass if the test condition resolves true,
* a fail otherwise.
* @param $condition Condition to test true.
* @param $message Message to display.
* @public
*/
function assert($condition, $message = false)
{
parent::assertTrue($condition, $message);
}
示例4: error
/**
* Sends an error which we interpret as a fail
* with a different message for compatibility.
* @param $message Message to display.
* @public
*/
function error($message)
{
parent::assertTrue(false, "Error triggered [{$message}]");
}