cvs: pear /PHPUnit/Framework TestSuite.php

From: Date: Thu, 18 Mar 2004 14:53:10 +0000
Subject: cvs: pear /PHPUnit/Framework TestSuite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-17510@lists.php.net to get a copy of this message
sebastian Thu Mar 18 09:53:10 2004 EDT Modified files: /pear/PHPUnit/Framework TestSuite.php Log: Hopefully improve the constructor to allow for both the JUnit and a more PHP-ish way of doing things. http://cvs.php.net/diff.php/pear/PHPUnit/Framework/TestSuite.php?r1=1.17&r2=1.18&ty=u Index: pear/PHPUnit/Framework/TestSuite.php diff -u pear/PHPUnit/Framework/TestSuite.php:1.17 pear/PHPUnit/Framework/TestSuite.php:1.18 --- pear/PHPUnit/Framework/TestSuite.php:1.17 Thu Mar 18 09:09:19 2004 +++ pear/PHPUnit/Framework/TestSuite.php Thu Mar 18 09:53:08 2004 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestSuite.php,v 1.17 2004/03/18 14:09:19 sebastian Exp $ +// $Id: TestSuite.php,v 1.18 2004/03/18 14:53:08 sebastian Exp $ // require_once 'PHPUnit/Framework/Test.php'; @@ -76,8 +76,10 @@ * constructs a TestSuite from the given class with the given * name. * - * - PHPUnit_Framework_TestSuite(String) constructs an empty - * TestSuite with the given name. + * - PHPUnit_Framework_TestSuite(String) either constructs a + * TestSuite from the given class (if the passed string is the + * name of an existing class) or constructs an empty TestSuite + * with the given name. * * @param optional mixed $theClass * @param optional string $name @@ -85,11 +87,21 @@ */ public function __construct($theClass = '', $name = '') { if (is_string($theClass)) { - $this->setName($theClass); + if (class_exists($theClass)) { + if ($name == '') { + $name = $theClass; + } + + $theClass = new Reflection_Class($theClass); + } else { + $this->setName($theClass); - return; + return; + } } + $this->setName($name); + $constructor = $theClass->getConstructor(); if ($constructor === NULL ||

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