@@ 27-36 (lines=10) @@ | ||
24 | class AsyncTest extends TestCase |
|
25 | { |
|
26 | ||
27 | public function testAsync() |
|
28 | { |
|
29 | $time = time(); |
|
30 | ||
31 | Yii::$app->async->run(function () { |
|
32 | sleep(10); |
|
33 | }); |
|
34 | ||
35 | $this->assertTrue((time() - $time) < 10); |
|
36 | } |
|
37 | ||
38 | public function testWait() |
|
39 | { |
|
@@ 38-47 (lines=10) @@ | ||
35 | $this->assertTrue((time() - $time) < 10); |
|
36 | } |
|
37 | ||
38 | public function testWait() |
|
39 | { |
|
40 | $time = time(); |
|
41 | ||
42 | Yii::$app->async->run(function () { |
|
43 | sleep(10); |
|
44 | })->wait(); |
|
45 | ||
46 | $this->assertTrue((time() - $time) >= 10); |
|
47 | } |
|
48 | ||
49 | public function testSuccessEvent() |
|
50 | { |