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); }
/** * 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); }
public static function assertTrue($condition, $message = '') { parent::assertTrue((bool) $condition, $message); }