PEAR_Info TestSuite with PHPUnit 3.1.x

From: Date: Sat, 28 Jul 2007 11:06:08 +0000
Subject: PEAR_Info TestSuite with PHPUnit 3.1.x
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-47714@lists.php.net to get a copy of this message
Hi all, If I post this mail, it just to give a warning to all others maintainers /developpers that will use PHPUnit 3.1.x and need to implement PEAR_Config class (file PEAR/Config.php). Christian Weiske, few days ago gave me feedback about PEAR_Info that crashed the global PEAR_ALLTests suite. My first mind was to thouhgt that it was a local copy of PEAR_Info problem (missing directories, etc ). But recently I've upgraded my PHPUnit local copy from 3.1.2 to 3.1.3 and run again my PEAR_Info test suite to get and finally found the real problem. PHPUnit framework need also PEAR_Config class and require_once / include_once call. Have a quick look on PEAR_Config implement [1] lines 59 to 65 59. if (getenv('PHP_PEAR_SYSCONF_DIR')) {
60.     define('PEAR_CONFIG_SYSCONFDIR',
getenv('PHP_PEAR_SYSCONF_DIR')); 61. } elseif (getenv('SystemRoot')) {
62.    define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot'));
63. } else {
64.    define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
65. } When in your user-script you use: require_one 'PEAR/Config.php' PEAR_CONFIG_SYSCONFDIR constant is already defined and won't be overridden once again. That is the real reason why PEAR_Info crashed with first test case (PEAR_Info_TestCase_DefaultConfig) when I try to re-use PEAR_Config with env var PHP_PEAR_SYSCONF_DIR new setting (see setUp() method). To resume: If you want to use PEAR/Config.php file, take care to call it once before 'PHPUnit/Framework.php'. Because PHPUnit/Framework.php call others files that in some of them include the PEAR/Config. Regards Laurent Laville [1] CVS: $Id: Config.php,v 1.137 2006/11/19 21:33:00 cellog Exp $

« previous php.pear.dev (#47714) next »