|
6 | 6 |
|
7 | 7 | class FunctionAwaitTest extends TestCase |
8 | 8 | { |
| 9 | + /** |
| 10 | + * @expectedException Exception |
| 11 | + * @expectedExceptionMessage test |
| 12 | + */ |
9 | 13 | public function testAwaitOneRejected() |
10 | 14 | { |
11 | 15 | $promise = $this->createPromiseRejected(new Exception('test')); |
12 | 16 |
|
13 | | - $this->setExpectedException('Exception', 'test'); |
14 | 17 | Block\await($promise, $this->loop); |
15 | 18 | } |
16 | 19 |
|
| 20 | + /** |
| 21 | + * @expectedException UnexpectedValueException |
| 22 | + */ |
17 | 23 | public function testAwaitOneRejectedWithFalseWillWrapInUnexpectedValueException() |
18 | 24 | { |
19 | 25 | $promise = Promise\reject(false); |
20 | 26 |
|
21 | | - $this->setExpectedException('UnexpectedValueException'); |
22 | 27 | Block\await($promise, $this->loop); |
23 | 28 | } |
24 | 29 |
|
| 30 | + /** |
| 31 | + * @expectedException UnexpectedValueException |
| 32 | + */ |
25 | 33 | public function testAwaitOneRejectedWithNullWillWrapInUnexpectedValueException() |
26 | 34 | { |
27 | 35 | $promise = Promise\reject(null); |
28 | 36 |
|
29 | | - $this->setExpectedException('UnexpectedValueException'); |
30 | 37 | Block\await($promise, $this->loop); |
31 | 38 | } |
32 | 39 |
|
@@ -61,11 +68,13 @@ public function testAwaitOneInterrupted() |
61 | 68 | $this->assertEquals(2, Block\await($promise, $this->loop)); |
62 | 69 | } |
63 | 70 |
|
| 71 | + /** |
| 72 | + * @expectedException React\Promise\Timer\TimeoutException |
| 73 | + */ |
64 | 74 | public function testAwaitOncePendingWillThrowOnTimeout() |
65 | 75 | { |
66 | 76 | $promise = new Promise\Promise(function () { }); |
67 | 77 |
|
68 | | - $this->setExpectedException('React\Promise\Timer\TimeoutException'); |
69 | 78 | Block\await($promise, $this->loop, 0.001); |
70 | 79 | } |
71 | 80 |
|
|
0 commit comments