本文整理汇总了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);
}