cvs: pear /PHPUnit2/Util Test.php

From: Date: Mon, 27 Feb 2006 10:16:22 +0000
Subject: cvs: pear /PHPUnit2/Util Test.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38676@lists.php.net to get a copy of this message
sebastian Mon Feb 27 10:16:22 2006 UTC Modified files: /pear/PHPUnit2/Util Test.php Log: Implement alternative result format. http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Util/Test.php?r1=1.1&r2=1.2&diff_format=u Index: pear/PHPUnit2/Util/Test.php diff -u pear/PHPUnit2/Util/Test.php:1.1 pear/PHPUnit2/Util/Test.php:1.2 --- pear/PHPUnit2/Util/Test.php:1.1 Mon Feb 27 05:47:03 2006 +++ pear/PHPUnit2/Util/Test.php Mon Feb 27 10:16:22 2006 @@ -41,7 +41,7 @@ * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @version CVS: $Id: Test.php,v 1.1 2006/02/27 05:47:03 sebastian Exp $ + * @version CVS: $Id: Test.php,v 1.2 2006/02/27 10:16:22 sebastian Exp $ * @link http://pear.php.net/package/PHPUnit2 * @since File available since Release 3.0.0 */ @@ -74,17 +74,34 @@ { /** * @param PHPUnit2_Framework_Test $test - * @return string + * @param boolean $asString + * @return mixed * @access public * @static * @since Method available since Release 3.0.0 */ - public static function describe(PHPUnit2_Framework_Test $test) + public static function describe(PHPUnit2_Framework_Test $test, $asString = TRUE) { - if ($test instanceof PHPUnit2_Framework_SelfDescribing) { - return $test->toString(); + if ($asString) { + if ($test instanceof PHPUnit2_Framework_SelfDescribing) { + return $test->toString(); + } else { + return get_class($test); + } } else { - return get_class($test); + if ($test instanceof PHPUnit2_Framework_TestCase) { + return array( + get_class($test), $test->getName() + ); + } + + else if ($test instanceof PHPUnit2_Framework_SelfDescribing) { + return array('', $test->toString()); + } + + else { + return array('', get_class($test)); + } } } }

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