cvs: pear /PHPUnit2/Util/Report/Coverage/Node File.php /PHPUnit2/Util/Report/Test/Node Test.php
| From: | Sebastian Bergmann | Date: | Thu, 15 Jun 2006 13:19:30 +0000 |
| Subject: | cvs: pear /PHPUnit2/Util/Report/Coverage/Node File.php /PHPUnit2/Util/Report/Test/Node Test.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-40714@lists.php.net to get a copy of this message | ||
sebastian Thu Jun 15 13:19:30 2006 UTC
Modified files:
/pear/PHPUnit2/Util/Report/Coverage/Node File.php
/pear/PHPUnit2/Util/Report/Test/Node Test.php
Log:
Another performance by Jan Kneschke <jan@kneschke.de>.
http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Util/Report/Coverage/Node/File.php?r1=1.11&r2=1.12&diff_format=u
Index: pear/PHPUnit2/Util/Report/Coverage/Node/File.php
diff -u pear/PHPUnit2/Util/Report/Coverage/Node/File.php:1.11
pear/PHPUnit2/Util/Report/Coverage/Node/File.php:1.12
--- pear/PHPUnit2/Util/Report/Coverage/Node/File.php:1.11 Wed Jun 14 11:33:21 2006
+++ pear/PHPUnit2/Util/Report/Coverage/Node/File.php Thu Jun 15 13:19:30 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: File.php,v 1.11 2006/06/14 11:33:21 sebastian Exp $
+ * @version CVS: $Id: File.php,v 1.12 2006/06/15 13:19:30 sebastian Exp $
* @link http://pear.php.net/package/PHPUnit2
* @since File available since Release 3.0.0
*/
@@ -221,7 +221,6 @@
*/
public function setupCoveringTests(PHPUnit2_Util_Report_Test_Node_TestSuite $testSuite, $files)
{
- $lastId = NULL;
$testCase = array();
$thisName = $this->getName(TRUE);
@@ -229,32 +228,12 @@
if ($thisName == $file) {
foreach ($lines as $line => $tests) {
foreach ($tests as $test) {
- $found = FALSE;
+ $testId = $test->__testNode->testId;
- if ($lastId !== NULL) {
- if ($testCase[$lastId]['object'] === $test) {
- $found = TRUE;
- }
- }
-
- if ($found === FALSE) {
- foreach ($testCase as $id => $coveringTest) {
- if ($coveringTest['object'] === $test) {
- $lastId = $id;
- $found = TRUE;
-
- break;
- }
- }
- }
-
- if ($found === FALSE) {
- $testCase[] = array(
- 'numLinesExecuted' => 1,
- 'object' => $test
- );
+ if (!isset($testCase[$testId])) {
+ $testCase[$testId] = array('numLinesExecuted' => 1,
'object' => $test);
} else {
- $testCase[$lastId]['numLinesExecuted']++;
+ $testCase[$testId]['numLinesExecuted']++;
}
}
}
http://cvs.php.net/viewcvs.cgi/pear/PHPUnit2/Util/Report/Test/Node/Test.php?r1=1.5&r2=1.6&diff_format=u
Index: pear/PHPUnit2/Util/Report/Test/Node/Test.php
diff -u pear/PHPUnit2/Util/Report/Test/Node/Test.php:1.5
pear/PHPUnit2/Util/Report/Test/Node/Test.php:1.6
--- pear/PHPUnit2/Util/Report/Test/Node/Test.php:1.5 Tue Jun 13 17:03:01 2006
+++ pear/PHPUnit2/Util/Report/Test/Node/Test.php Thu Jun 15 13:19:30 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.5 2006/06/13 17:03:01 sebastian Exp $
+ * @version CVS: $Id: Test.php,v 1.6 2006/06/15 13:19:30 sebastian Exp $
* @link http://pear.php.net/package/PHPUnit2
* @since File available since Release 3.0.0
*/
@@ -96,10 +96,13 @@
*/
public function __construct($name, PHPUnit2_Util_Report_Test_Node $parent,
PHPUnit2_Framework_Test $object, $result)
{
+ static $testId = 0;
+
parent::__construct($name, $parent);
$this->object = $object;
$this->result = $result;
+ $this->testId = $testId++;
$this->object->__testNode = $this;
}