cvs: pear /PHPUnit2 package.xml /PHPUnit2/Framework Assert.php

From: Date: Thu, 09 Jun 2005 17:51:40 +0000
Subject: cvs: pear /PHPUnit2 package.xml /PHPUnit2/Framework Assert.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32448@lists.php.net to get a copy of this message
sebastian Thu Jun 9 13:51:40 2005 EDT Modified files: /pear/PHPUnit2 package.xml /pear/PHPUnit2/Framework Assert.php Log: Make PHPUnit2_Framework_Assert::assertSame() and PHPUnit2_Framework_Assert::assertNotSame() work on non-objects. http://cvs.php.net/diff.php/pear/PHPUnit2/package.xml?r1=1.112&r2=1.113&ty=u Index: pear/PHPUnit2/package.xml diff -u pear/PHPUnit2/package.xml:1.112 pear/PHPUnit2/package.xml:1.113 --- pear/PHPUnit2/package.xml:1.112 Sun May 29 11:53:49 2005 +++ pear/PHPUnit2/package.xml Thu Jun 9 13:51:38 2005 @@ -30,6 +30,8 @@ * Code Coverage information is no longer collected by default (when the Xdebug extension is available) but only when it is requested (by using the --coverage-* parameters with the TextUI TestRunner, for instance). PHPUnit2_Framework_TestResult::collectCodeCoverageInformation(TRUE) has to be called to enable the collection of Code Coverage information. +* PHPUnit2_Framework_Assert::assertSame() and PHPUnit2_Framework_AssertNotSame() now work on non-objects and assert that two variables (do not) have the same type and value. + * PHPUnit2_Framework_Assert::assertType() and PHPUnit2_Framework_AssertNotType() now consider subclasses when used on objects. * PHPUnit2_Util_Skeleton now generates stubs for the setUp() and tearDown() methods. http://cvs.php.net/diff.php/pear/PHPUnit2/Framework/Assert.php?r1=1.44&r2=1.45&ty=u Index: pear/PHPUnit2/Framework/Assert.php diff -u pear/PHPUnit2/Framework/Assert.php:1.44 pear/PHPUnit2/Framework/Assert.php:1.45 --- pear/PHPUnit2/Framework/Assert.php:1.44 Thu May 26 12:05:36 2005 +++ pear/PHPUnit2/Framework/Assert.php Thu Jun 9 13:51:39 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.44 2005/05/26 16:05:36 sebastian Exp $ + * @version CVS: $Id: Assert.php,v 1.45 2005/06/09 17:51:39 sebastian Exp $ * @link http://pear.php.net/package/PHPUnit2 * @since File available since Release 2.0.0 */ @@ -285,44 +285,36 @@ } /** - * Asserts that two variables reference the same object. + * Asserts that two variables have the same type and value. + * Used on objects, it asserts that two variables reference + * the same object. * - * @param object $object - * @param object $object + * @param mixed $expected + * @param mixed $actual * @param string $message - * @throws InvalidArgumentException * @access public * @static */ public static function assertSame($expected, $actual, $message = '') { - if ((is_object($expected) || is_null($expected)) && - (is_object($actual) || is_null($actual))) { - if ($expected !== $actual) { - self::failNotSame($expected, $actual, $message); - } - } else { - throw new InvalidArgumentException; + if ($expected !== $actual) { + self::failNotSame($expected, $actual, $message); } } /** - * Asserts that two variables do not reference the same object. + * Asserts that two variables do not have the same type and value. + * Used on objects, it asserts that two variables do not reference + * the same object. * - * @param object $object - * @param object $object + * @param mixed $expected + * @param mixed $actual * @param string $message - * @throws InvalidArgumentException * @access public * @static */ public static function assertNotSame($expected, $actual, $message = '') { - if ((is_object($expected) || is_null($expected)) && - (is_object($actual) || is_null($actual))) { - if ($expected === $actual) { - self::failSame($expected, $actual, $message); - } - } else { - throw new InvalidArgumentException; + if ($expected === $actual) { + self::failSame($expected, $actual, $message); } }

« previous php.pear.cvs (#32448) next »