com phpruntests: phpruntests - minor bugfix task-scheduler: src/taskScheduler/rtTaskScheduler.php src/taskScheduler/rtTaskSchedulerFile.php
tests/rtTaskSchedulerTest.php
| From: | David Soria Parra | Date: | Sat, 27 Jun 2009 23:57:46 +0000 |
| Subject: | com phpruntests: phpruntests - minor bugfix task-scheduler: src/taskScheduler/rtTaskScheduler.php src/taskScheduler/rtTaskSchedulerFile.php tests/rtTaskSchedulerTest.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66399@lists.php.net to get a copy of this message | ||
Commit: 740d40725d0f1e40b6f85fce0253fe0ce4365343
Author: Georg Gradwohl <g2@php.net> Sat, 27 Jun 2009 23:57:46 +0000
Parents: 722330df76287b49edcb231148ac9c9100a01b61
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=740d40725d0f1e40b6f85fce0253fe0ce4365343
Log:
phpruntests - minor bugfix task-scheduler
Changed paths:
M src/taskScheduler/rtTaskScheduler.php
M src/taskScheduler/rtTaskSchedulerFile.php
M tests/rtTaskSchedulerTest.php
Diff:
diff --git a/src/taskScheduler/rtTaskScheduler.php b/src/taskScheduler/rtTaskScheduler.php
index 2932e0c..b887b52 100644
--- a/src/taskScheduler/rtTaskScheduler.php
+++ b/src/taskScheduler/rtTaskScheduler.php
@@ -107,24 +107,21 @@ class rtTaskScheduler
$task = $this->taskList[$i];
if ($task->run() === true) {
- $task->setState(task::PASS);
+ $task->setState(rtTask::PASS);
$this->countPass++;
} else {
- $task->setState(task::FAIL);
+ $task->setState(rtTask::FAIL);
$this->countFail++;
}
$this->memStore[] = memory_get_usage(true);
-
- print ".";
- flush();
-
+
$this->taskList[$i] = $task;
}
$error = microtime(true);
- $this->time = round($error-$s,5);
+ $this->time = round($e-$s,5);
return;
}
diff --git a/src/taskScheduler/rtTaskSchedulerFile.php b/src/taskScheduler/rtTaskSchedulerFile.php
index 05a790e..84f280d 100644
--- a/src/taskScheduler/rtTaskSchedulerFile.php
+++ b/src/taskScheduler/rtTaskSchedulerFile.php
@@ -151,8 +151,6 @@ class rtTaskSchedulerFile extends rtTaskScheduler
if ($this->groupTasks == true) {
- $c = 0;
-
foreach ($this->taskList as $key => $list) {
for ($i=0; $i<sizeof($list); $i++) {
@@ -165,7 +163,13 @@ class rtTaskSchedulerFile extends rtTaskScheduler
for ($i=0; $i<sizeof($this->taskList); $i++) {
- $taskStr[$i%$this->processCount] .= $i.';';
+ $cid = $i%$this->processCount;
+
+ if (!isset($taskStr[$cid])) {
+ $taskStr[$cid] = '';
+ }
+
+ $taskStr[$cid] .= $i.';';
}
}
diff --git a/tests/rtTaskSchedulerTest.php b/tests/rtTaskSchedulerTest.php
index cb0b47d..470d1aa 100644
--- a/tests/rtTaskSchedulerTest.php
+++ b/tests/rtTaskSchedulerTest.php
@@ -7,10 +7,11 @@ class rtTaskSchedulerTest extends PHPUnit_Framework_TestCase
{
public function testResult()
{
- // create 10 tasks with random numbers
$taskList = array();
$expected = array();
+ $results = array();
+ // create 10 tasks with random numbers
for ($i=0; $i<10; $i++) {
$n = rand(0,9);
$expected[$i] = $n+1;
@@ -24,8 +25,6 @@ class rtTaskSchedulerTest extends PHPUnit_Framework_TestCase
$scheduler->run();
// get the results from the manupilated task-list
- $results = array();
-
foreach ($scheduler->getTaskList() as $task) {
$results[] = $task->getNumber();
}
@@ -61,5 +60,4 @@ class rtTaskIncTest extends rtTask implements rtTaskInterface
}
}
-
-?>
+?>
\ No newline at end of file