@@ 28-37 (lines=10) @@ | ||
25 | class AsyncTest extends TestCase |
|
26 | { |
|
27 | ||
28 | public function testAsync() |
|
29 | { |
|
30 | $this->stopwatch->start('test'); |
|
31 | ||
32 | Yii::$app->async->run(function () { |
|
33 | sleep(3); |
|
34 | }); |
|
35 | ||
36 | $this->assertLessThan(3000, $this->stopwatch->stop('test')->getDuration()); |
|
37 | } |
|
38 | ||
39 | public function testWait() |
|
40 | { |
|
@@ 39-48 (lines=10) @@ | ||
36 | $this->assertLessThan(3000, $this->stopwatch->stop('test')->getDuration()); |
|
37 | } |
|
38 | ||
39 | public function testWait() |
|
40 | { |
|
41 | $this->stopwatch->start('test'); |
|
42 | ||
43 | Yii::$app->async->run(function () { |
|
44 | sleep(3); |
|
45 | })->wait(); |
|
46 | ||
47 | $this->assertGreaterThan(3000, $this->stopwatch->stop('test')->getDuration()); |
|
48 | } |
|
49 | ||
50 | public function testSuccessEvent() |
|
51 | { |