File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,14 @@ protected function tearDown()
62
62
{
63
63
parent ::tearDown ();
64
64
65
- // cleanup
66
- $ this ->async ->purge (TestTask::$ queueName );
67
- if ($ this ->async ->receiveTask ('wrong ' )) {
68
- $ this ->async ->purge ('wrong ' );
65
+ if (\Yii::$ app ) {
66
+ $ this ->async = \Yii::$ app ->async ;
67
+
68
+ // cleanup
69
+ $ this ->async ->purge (TestTask::$ queueName );
70
+ if ($ this ->async ->receiveTask ('wrong ' )) {
71
+ $ this ->async ->purge ('wrong ' );
72
+ }
69
73
}
70
74
}
71
75
@@ -215,7 +219,7 @@ public function testSubscribe()
215
219
216
220
$ fork = $ manager ->fork (
217
221
function () use ($ task ) {
218
- return \Yii::$ app ->asyncFork ->receiveTask ($ task ::$ queueName, true );
222
+ return \Yii::$ app ->asyncFork ->waitAndReceive ($ task ::$ queueName );
219
223
}
220
224
);
221
225
@@ -224,6 +228,7 @@ function () use ($task) {
224
228
$ fork ->then (
225
229
function (\Spork \Fork $ fork ) {
226
230
$ task = $ fork ->getResult ();
231
+ $ this ->assertNotEmpty ($ task );
227
232
$ this ->assertEquals (1 , $ task ->execute ());
228
233
}
229
234
);
You can’t perform that action at this time.
0 commit comments