[pLog-svn] r3734 - in plog/trunk: . class/test

Mark Wu markplace at gmail.com
Mon Jul 17 21:55:55 GMT 2006


Hi Oscar:

There are two problems when I run the test runner in windowsxp/php5.

1. the .svn have to exclude. So I create a new private variable
$excludeFolers to represent it.
2. the suite name in runtests.php must be in lowercase. Because the fnmatch
is cas senstive. So, I use strtolower()  to convert it to lower case before
we pass the value to test runner.

After these two fix, the runtests.php runs very well in windows xp/php5 ...

Would you kindly verify it can in your environment or not? If not, just
revert my changes.

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> mark at devel.lifetype.net
> Sent: Tuesday, July 18, 2006 5:17 AM
> To: plog-svn at devel.lifetype.net
> Subject: [pLog-svn] r3734 - in plog/trunk: . class/test
> 
> Author: mark
> Date: 2006-07-17 21:16:30 +0000 (Mon, 17 Jul 2006) New Revision: 3734
> 
> Modified:
>    plog/trunk/class/test/testrunner.class.php
>    plog/trunk/runtests.php
> Log:
> Some bug fixed.
> 
> Modified: plog/trunk/class/test/testrunner.class.php
> ===================================================================
> --- plog/trunk/class/test/testrunner.class.php	
> 2006-07-17 20:47:17 UTC (rev 3733)
> +++ plog/trunk/class/test/testrunner.class.php	
> 2006-07-17 21:16:30 UTC (rev 3734)
> @@ -35,6 +35,11 @@
>  	 * pattern for test class names
>  	 */
>  	define( "TEST_CLASS_NAME_PATTERN", "*_test.class.php" );
> +
> +	/**
> +	 * Exclude folders, seperated by comma
> +	 **/
> +	define( "EXCLUDE_FOLDERS_LIST", ".svn" );
>  	
>  	class TestRunner
>  	{
> @@ -42,11 +47,13 @@
>  		var $pattern;
>  		var $files;
>  		var $suite;
> +		var $excludeFolders;
>  		
>  		function TestRunner( $folder = 
> TEST_CLASS_FOLDER, $pattern = TEST_CLASS_NAME_PATTERN )
>  		{
>  			$this->folder = $folder;
>  			$this->pattern = $pattern;
> +			$this->excludeFolders = explode( ",", 
> EXCLUDE_FOLDERS_LIST );
>  			
>  			$this->files = $this->_findClasses( 
> $this->folder, $this->pattern );
>  		}
> @@ -118,9 +125,12 @@
>  			foreach( $files as $file ) {
>  				// recursive call
>  				if( File::isDir( $file )) {
> -					$res = 
> $this->_findClasses( $file, $pattern );
> -					foreach( $res as $f ) {
> -						$list[] = $f;
> +					if( array_search( 
> basename( $file ), $this->excludeFolders ) === false )
> +					{
> +						$res = 
> $this->_findClasses( $file, $pattern );
> +						foreach( $res as $f ) {
> +							$list[] = $f;
> +						}
>  					}
>  				}
>  				else {
> 
> Modified: plog/trunk/runtests.php
> ===================================================================
> --- plog/trunk/runtests.php	2006-07-17 20:47:17 UTC (rev 3733)
> +++ plog/trunk/runtests.php	2006-07-17 21:16:30 UTC (rev 3734)
> @@ -15,7 +15,7 @@
>  	
>  	// get the suite name from the request or run all of 
> them if no parameter specified
>  	$request = HttpVars::getRequest();
> -	$suiteName = isset( $request["suite"] ) ? 
> $request["suite"] : "";
> +	$suiteName = isset( $request["suite"] ) ? 
> +strtolower($request["suite"]) : "";
>  
>  	// create a new TestRunner class, which will take care 
> of loading all our
>  	// tests cases, instantiate them and tell PHPUnit to 
> run the tests specified
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list