cvs: pear /PHPUnit2/Framework Assert.php
| From: | Sebastian Bergmann | Date: | Thu, 23 Dec 2004 07:08:39 +0000 |
| Subject: | cvs: pear /PHPUnit2/Framework Assert.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-27774@lists.php.net to get a copy of this message | ||
sebastian Thu Dec 23 02:08:39 2004 EDT
Modified files:
/pear/PHPUnit2/Framework Assert.php
Log:
Make assertTrue() and assertFalse() strict, too.
http://cvs.php.net/diff.php/pear/PHPUnit2/Framework/Assert.php?r1=1.25&r2=1.26&ty=u
Index: pear/PHPUnit2/Framework/Assert.php
diff -u pear/PHPUnit2/Framework/Assert.php:1.25 pear/PHPUnit2/Framework/Assert.php:1.26
--- pear/PHPUnit2/Framework/Assert.php:1.25 Wed Dec 22 03:05:53 2004
+++ pear/PHPUnit2/Framework/Assert.php Thu Dec 23 02:08:39 2004
@@ -12,7 +12,7 @@
// | license@php.net so we can mail you a copy immediately. |
// +------------------------------------------------------------------------+
//
-// $Id: Assert.php,v 1.25 2004/12/22 08:05:53 sebastian Exp $
+// $Id: Assert.php,v 1.26 2004/12/23 07:08:39 sebastian Exp $
//
require_once 'PHPUnit2/Framework/AssertionFailedError.php';
@@ -158,8 +158,12 @@
* @static
*/
public static function assertTrue($condition, $message = '') {
- if (!$condition) {
- self::fail($message);
+ if (is_bool($condition)) {
+ if (!$condition) {
+ self::fail($message);
+ }
+ } else {
+ throw new Exception('Unsupported parameter passed to assertTrue().');
}
}
@@ -175,7 +179,12 @@
* @static
*/
public static function assertFalse($condition, $message = '') {
- self::assertTrue(!$condition, $message);
+ if (is_bool($condition)) {
+ self::assertTrue(!$condition, $message);
+ } else {
+ throw new Exception('Unsupported parameter passed to assertFalse().');
+ }
+
}
// }}}