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