cvs: pear /PHPUnit2/Framework Assert.php
| From: | Sebastian Bergmann | Date: | Mon, 18 Apr 2005 14:28:59 +0000 |
| Subject: | cvs: pear /PHPUnit2/Framework Assert.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-31279@lists.php.net to get a copy of this message | ||
sebastian Mon Apr 18 10:28:59 2005 EDT
Modified files:
/pear/PHPUnit2/Framework Assert.php
Log:
Add argument checks.
http://cvs.php.net/diff.php/pear/PHPUnit2/Framework/Assert.php?r1=1.37&r2=1.38&ty=u
Index: pear/PHPUnit2/Framework/Assert.php
diff -u pear/PHPUnit2/Framework/Assert.php:1.37 pear/PHPUnit2/Framework/Assert.php:1.38
--- pear/PHPUnit2/Framework/Assert.php:1.37 Mon Apr 18 10:25:11 2005
+++ pear/PHPUnit2/Framework/Assert.php Mon Apr 18 10:28:57 2005
@@ -15,7 +15,7 @@
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Assert.php,v 1.37 2005/04/18 14:25:11 sebastian Exp $
+ * @version CVS: $Id: Assert.php,v 1.38 2005/04/18 14:28:57 sebastian Exp $
* @link http://pear.php.net/package/PHPUnit2
* @since File available since Release 2.0.0
*/
@@ -432,6 +432,10 @@
* @since Method available since Release 2.2.0
*/
private static function doAssertType($expected, $actual, $condition, $message) {
+ if (!is_string($expected)) {
+ throw new InvalidArgumentException;
+ }
+
if (is_object($actual)) {
$result = is_a($actual, $expected);
} else {
@@ -465,6 +469,10 @@
* @since Method available since Release 2.2.0
*/
private static function doAssertRegExp($pattern, $string, $condition, $message) {
+ if (!is_string($pattern) || !is_string($string)) {
+ throw new InvalidArgumentException;
+ }
+
$result = preg_match($pattern, $string);
if ($condition && !$result) {