當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CakeTestCase::assertTrue方法代碼示例

本文整理匯總了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);
 }
開發者ID:robksawyer,項目名稱:grabitdown,代碼行數:7,代碼來源:MyCakeTestCase.php

示例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);
 }
開發者ID:beckye67,項目名稱:Icing,代碼行數:22,代碼來源:AppTestCase.php

示例3: assertTrue

 public static function assertTrue($condition, $message = '')
 {
     parent::assertTrue((bool) $condition, $message);
 }
開發者ID:pmoraes,項目名稱:templates,代碼行數:4,代碼來源:AppTestCase.php


注:本文中的CakeTestCase::assertTrue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。