本文整理匯總了PHP中CakeTestCase::assertTrue方法的典型用法代碼示例。如果您正苦於以下問題:PHP CakeTestCase::assertTrue方法的具體用法?PHP CakeTestCase::assertTrue怎麽用?PHP CakeTestCase::assertTrue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CakeTestCase
的用法示例。
在下文中一共展示了CakeTestCase::assertTrue方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: assertIsTrue
public static function assertIsTrue($is, $title = null, $value = null, $message = '')
{
$expectation = 'TRUE';
echo self::_title($expectation, $title);
self::_printResult($is, $value);
return parent::assertTrue($is, $message);
}
示例2: assertTimestamp
/**
* Assert that a timetstamp is within a certain tolerance of seconds
*
* @param string $timetstamp (parseable via strtotime)
* @param string $match [now] (parseable via strtotime)
* @param int $toleranceSeconds [5] number of seconds allowed as delta/diff
* @param string $message if fails
*/
public function assertTimestamp($timestamp, $match = 'now', $toleranceSeconds = 5, $message = null)
{
if (empty($timestamp)) {
$message = 'The timestamp was empty';
return parent::assertTrue(false, $message);
}
$epoch = strtotime($timestamp);
$match = strtotime($match);
$diff = abs($epoch - $match);
if (empty($message)) {
$message = sprintf('The timestamp %s was not within %s seconds of %s (%s seconds apart)', $timestamp, $toleranceSeconds, date('Y-m-d H:i:s', $match), $diff);
}
parent::assertTrue($diff <= $toleranceSeconds, $message);
}
示例3: assertTrue
public static function assertTrue($condition, $message = '')
{
parent::assertTrue((bool) $condition, $message);
}