diff --git a/composer.json b/composer.json index 7039acb..30f162f 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,6 @@ "react/promise-timer": "~1.0" }, "require-dev": { - "phpunit/phpunit": "^5.0 || ^4.8" + "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35" } } diff --git a/tests/FunctionAwaitAllTest.php b/tests/FunctionAwaitAllTest.php index 0b9cea7..8ce5d9f 100644 --- a/tests/FunctionAwaitAllTest.php +++ b/tests/FunctionAwaitAllTest.php @@ -21,6 +21,10 @@ public function testAwaitAllAllResolved() $this->assertEquals(array('first' => 1, 'second' => 2), Block\awaitAll($all, $this->loop)); } + /** + * @expectedException Exception + * @expectedExceptionMessage test + */ public function testAwaitAllRejected() { $all = array( @@ -28,10 +32,12 @@ public function testAwaitAllRejected() $this->createPromiseRejected(new Exception('test')) ); - $this->setExpectedException('Exception', 'test'); Block\awaitAll($all, $this->loop); } + /** + * @expectedException UnexpectedValueException + */ public function testAwaitAllRejectedWithFalseWillWrapInUnexpectedValueException() { $all = array( @@ -39,10 +45,13 @@ public function testAwaitAllRejectedWithFalseWillWrapInUnexpectedValueException( Promise\reject(false) ); - $this->setExpectedException('UnexpectedValueException'); Block\awaitAll($all, $this->loop); } + /** + * @expectedException Exception + * @expectedExceptionMessage first + */ public function testAwaitAllOnlyRejected() { $all = array( @@ -50,7 +59,6 @@ public function testAwaitAllOnlyRejected() $this->createPromiseRejected(new Exception('second')) ); - $this->setExpectedException('Exception', 'first'); Block\awaitAll($all, $this->loop); } diff --git a/tests/FunctionAwaitAnyTest.php b/tests/FunctionAwaitAnyTest.php index 3747b34..424d1ba 100644 --- a/tests/FunctionAwaitAnyTest.php +++ b/tests/FunctionAwaitAnyTest.php @@ -47,6 +47,9 @@ public function testAwaitAnyFirstResolvedConcurrently() $this->assertEquals(2, Block\awaitAny($all, $this->loop)); } + /** + * @expectedException UnderflowException + */ public function testAwaitAnyAllRejected() { $all = array( @@ -54,7 +57,6 @@ public function testAwaitAnyAllRejected() $this->createPromiseRejected(2) ); - $this->setExpectedException('UnderflowException'); Block\awaitAny($all, $this->loop); } diff --git a/tests/FunctionAwaitTest.php b/tests/FunctionAwaitTest.php index f81c488..178c325 100644 --- a/tests/FunctionAwaitTest.php +++ b/tests/FunctionAwaitTest.php @@ -6,27 +6,34 @@ class FunctionAwaitTest extends TestCase { + /** + * @expectedException Exception + * @expectedExceptionMessage test + */ public function testAwaitOneRejected() { $promise = $this->createPromiseRejected(new Exception('test')); - $this->setExpectedException('Exception', 'test'); Block\await($promise, $this->loop); } + /** + * @expectedException UnexpectedValueException + */ public function testAwaitOneRejectedWithFalseWillWrapInUnexpectedValueException() { $promise = Promise\reject(false); - $this->setExpectedException('UnexpectedValueException'); Block\await($promise, $this->loop); } + /** + * @expectedException UnexpectedValueException + */ public function testAwaitOneRejectedWithNullWillWrapInUnexpectedValueException() { $promise = Promise\reject(null); - $this->setExpectedException('UnexpectedValueException'); Block\await($promise, $this->loop); } @@ -61,11 +68,13 @@ public function testAwaitOneInterrupted() $this->assertEquals(2, Block\await($promise, $this->loop)); } + /** + * @expectedException React\Promise\Timer\TimeoutException + */ public function testAwaitOncePendingWillThrowOnTimeout() { $promise = new Promise\Promise(function () { }); - $this->setExpectedException('React\Promise\Timer\TimeoutException'); Block\await($promise, $this->loop, 0.001); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b3fba8d..42244fe 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,12 +1,13 @@