cvs: pear /PHPUnit2 package.xml /PHPUnit2/Util Skeleton.php

From: Date: Fri, 17 Mar 2006 17:33:20 +0000
Subject: cvs: pear /PHPUnit2 package.xml /PHPUnit2/Util Skeleton.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39161@lists.php.net to get a copy of this message
sebastian Fri Mar 17 17:33:20 2006 UTC Modified files: /pear/PHPUnit2/Util Skeleton.php /pear/PHPUnit2 package.xml Log: Fix bug #7106: phpunit --skeleton does not seem to handle PEARified names. http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Util/Skeleton.php?r1=1.35&r2=1.36&diff_format=u Index: pear/PHPUnit2/Util/Skeleton.php diff -u pear/PHPUnit2/Util/Skeleton.php:1.35 pear/PHPUnit2/Util/Skeleton.php:1.36 --- pear/PHPUnit2/Util/Skeleton.php:1.35 Thu Mar 9 10:39:13 2006 +++ pear/PHPUnit2/Util/Skeleton.php Fri Mar 17 17:33:19 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: Skeleton.php,v 1.35 2006/03/09 10:39:13 sebastian Exp $ + * @version CVS: $Id: Skeleton.php,v 1.36 2006/03/17 17:33:19 sebastian Exp $ * @link http://pear.php.net/package/PHPUnit2 * @since File available since Release 2.1.0 */ @@ -84,6 +84,12 @@ protected $classSourceFile; /** + * @var string + * @access protected + */ + protected $testSourceFile; + + /** * Constructor. * * @param string $className @@ -93,13 +99,17 @@ */ public function __construct($className, $classSourceFile = '') { - if ($classSourceFile == '') { - $classSourceFile = $className . '.php'; + if (file_exists($className . '.php')) { + $this->classSourceFile = $className . '.php'; + $this->testSourceFile = $className . 'Test.php'; } - if (file_exists($classSourceFile)) { - $this->classSourceFile = $classSourceFile; - } else { + else if (file_exists(str_replace('_', '/', $className) . '.php')) { + $this->classSourceFile = str_replace('_', '/', $className) . '.php'; + $this->testSourceFile = str_replace('_', '/', $className) . 'Test.php'; + } + + else { throw new RuntimeException( sprintf( 'Could not open %s.', @@ -119,7 +129,7 @@ 'Could not find class "%s" in %s.', $className, - $classSourceFile + $this->classSourceFile ) ); } @@ -200,7 +210,7 @@ public function write($file = '') { if ($file == '') { - $file = $this->className . 'Test.php'; + $file = $this->testSourceFile; } if ($fp = @fopen($file, 'w')) { @@ -208,6 +218,16 @@ @fclose($fp); } } + + /** + * @return string + * @access public + * @since Method available since Release 3.0.0 + */ + public function getTestSourceFile() + { + return $this->testSourceFile; + } } /* http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/package.xml?r1=1.184&r2=1.185&diff_format=u Index: pear/PHPUnit2/package.xml diff -u pear/PHPUnit2/package.xml:1.184 pear/PHPUnit2/package.xml:1.185 --- pear/PHPUnit2/package.xml:1.184 Thu Mar 16 07:47:32 2006 +++ pear/PHPUnit2/package.xml Fri Mar 17 17:33:20 2006 @@ -67,6 +67,8 @@ * Fixed bug #5933: PHPUnit2_Framework_TestSuite::addTestFile() and non-working directories. +* Fixed bug #7106: phpunit --skeleton does not seem to handle PEARified names. + - Removed --coverage-data, --coverage-html, and --coverage-text options from the command-line test runner. - Removed PHPUnit2_Framework_Assert::setLooselyTyped().

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