File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ public function getEncodedTaskID(): string
6363 }
6464
6565 /**
66- * Returns whether the AsyncTask is still running.
66+ * Checks and returns whether the AsyncTask is still running. This may take a bit of time .
6767 *
6868 * Note: when this method detects that the task has stopped running, it will not recheck whether the task has restarted.
6969 * Use a fresh status object to track the (restarted) task.
Original file line number Diff line number Diff line change @@ -248,14 +248,9 @@ public function testAsyncTaskNormalStatus()
248248 $ liveStatus = $ task ->start ();
249249
250250 // the task is to sleep for 2 seconds, and then exit.
251- for ($ i = 0 ; $ i < 2 ; $ i ++) {
252- // check the statuses; most likely still be running
253- $ this ->assertFalse ($ preStatus ->isRunning (), "Incorrect pre-run task status at loop $ i " );
254- $ this ->assertTrue ($ liveStatus ->isRunning (), "Incorrect live-run task status at loop $ i " );
255- $ this ->sleep (0.9 );
256- }
257- // should have finished
258- $ this ->assertFalse ($ preStatus ->isRunning (), "Incorrect pre-run task status at loop end " );
259- $ this ->assertFalse ($ liveStatus ->isRunning (), "Incorrect live-run task status at loop end " );
251+ // note: since checking the task statuses take some time, we cannot confirm the actual elapsed time of our tests,
252+ // and so "task ended" case is not testable
253+ $ this ->assertFalse ($ preStatus ->isRunning (), "Stopped tasks should always report \"task stopped \". " );
254+ $ this ->assertTrue ($ liveStatus ->isRunning (), "Recently-started task does not report \"task running \". " );
260255 }
261256}
You can’t perform that action at this time.
0 commit comments