cvs: pear /PHPUnit2 package.xml /PHPUnit2/Framework Assert.php
| From: | Sebastian Bergmann | Date: | Mon, 25 Oct 2004 15:15:20 +0000 |
| Subject: | cvs: pear /PHPUnit2 package.xml /PHPUnit2/Framework Assert.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-25199@lists.php.net to get a copy of this message | ||
sebastian Mon Oct 25 11:15:20 2004 EDT
Modified files:
/pear/PHPUnit2 package.xml
/pear/PHPUnit2/Framework Assert.php
Log:
Add PHPUnit2_Framework_Assert::assertNotType().
http://cvs.php.net/diff.php/pear/PHPUnit2/package.xml?r1=1.64&r2=1.65&ty=u
Index: pear/PHPUnit2/package.xml
diff -u pear/PHPUnit2/package.xml:1.64 pear/PHPUnit2/package.xml:1.65
--- pear/PHPUnit2/package.xml:1.64 Mon Oct 25 10:36:24 2004
+++ pear/PHPUnit2/package.xml Mon Oct 25 11:15:18 2004
@@ -26,6 +26,8 @@
+ Added PHPUnit2_Extensions_ExceptionTestCase::getExpectedException() and
PHPUnit2_Extensions_ExceptionTestCase::setExpectedException().
++ Added PHPUnit2_Framework_Assert::assertNotType() to complement
PHPUnit2_Framework_Assert::assertType().
+
* PHPUnit2_Framework_Assert::assertContains() and PHPUnit2_Framework_Assert::assertNotContains()
now accept an object that offers the Iterator interface for the $haystack parameter.
]]>
</notes>
http://cvs.php.net/diff.php/pear/PHPUnit2/Framework/Assert.php?r1=1.20&r2=1.21&ty=u
Index: pear/PHPUnit2/Framework/Assert.php
diff -u pear/PHPUnit2/Framework/Assert.php:1.20 pear/PHPUnit2/Framework/Assert.php:1.21
--- pear/PHPUnit2/Framework/Assert.php:1.20 Mon Oct 25 10:36:25 2004
+++ pear/PHPUnit2/Framework/Assert.php Mon Oct 25 11:15:19 2004
@@ -12,7 +12,7 @@
// | license@php.net so we can mail you a copy immediately. |
// +------------------------------------------------------------------------+
//
-// $Id: Assert.php,v 1.20 2004/10/25 14:36:25 sebastian Exp $
+// $Id: Assert.php,v 1.21 2004/10/25 15:15:19 sebastian Exp $
//
require_once 'PHPUnit2/Framework/AssertionFailedError.php';
@@ -302,7 +302,6 @@
* @access public
* @static
*/
-
public static function assertType($expected, $actual, $message = '') {
if (is_object($actual)) {
$actual = get_class($actual);
@@ -320,6 +319,35 @@
}
// }}}
+ // {{{ public static function assertNotType($expected, $actual, $message = '')
+
+ /**
+ * Asserts that a variable is not of a given type.
+ *
+ * @param string $expected
+ * @param mixed $actual
+ * @param string $message
+ * @access public
+ * @static
+ * @since 2.2.0
+ */
+ public static function assertNotType($expected, $actual, $message = '') {
+ if (is_object($actual)) {
+ $actual = get_class($actual);
+ } else {
+ $actual = gettype($actual);
+ }
+
+ if ($expected == $actual) {
+ self::failEquals(
+ $expected,
+ $actual,
+ $message
+ );
+ }
+ }
+
+ // }}}
// {{{ public static function assertRegExp($pattern, $string, $message = '')
/**