1
0
mirror of synced 2025-01-29 19:41:45 +03:00

more efficient memory handling

This commit is contained in:
zYne 2007-07-16 18:31:52 +00:00
parent 9ad3a0fc51
commit 5b4c4ffd65

View File

@ -1,5 +1,5 @@
<?php <?php
class GroupTest class GroupTest extends UnitTestCase
{ {
protected $_testCases = array(); protected $_testCases = array();
@ -16,42 +16,28 @@ class GroupTest
} }
public function run(HtmlReporter $reporter) public function run(HtmlReporter $reporter)
{ {
foreach ($this->_testCases as $testCase) { foreach ($this->_testCases as $k => $testCase) {
$testCase->run(); $testCase->run();
$this->_passed += $testCase->getPassCount();
$this->_failed += $testCase->getFailCount();
$this->_messages += $testCase->getMessages();
$this->_testCases[$k] = null;
} }
$reporter->setTestCase($this); $reporter->setTestCase($this);
$reporter->paintHeader(); $reporter->paintHeader();
$reporter->paintFooter(); $reporter->paintFooter();
} }
public function getMessages()
{
$messages = array();
foreach($this->_testCases as $testCase) {
$messages = array_merge($messages, $testCase->getMessages());
}
return $messages;
}
public function getFailCount()
{
$fails = 0;
foreach ($this->_testCases as $testCase) {
$fails += $testCase->getFailCount();
}
return $fails;
}
public function getTestCaseCount() public function getTestCaseCount()
{ {
return count($this->_testCases); return count($this->_testCases);
} }
public function getPassCount()
{
$passes = 0;
foreach ($this->_testCases as $testCase) {
$passes += $testCase->getPassCount();
}
return $passes;
}
} }
class HtmlReporter class HtmlReporter
{ {