diff --git a/src/TestCase.php b/src/TestCase.php index f21dc59..4de0177 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -33,6 +33,7 @@ protected function setUp() public function assertPromiseFulfills(PromiseInterface $promise, $timeout = null) { $failMessage = 'Failed asserting that promise fulfills. '; + $this->addToAssertionCount(1); try { return $this->waitForPromise($promise, $timeout); @@ -41,7 +42,6 @@ public function assertPromiseFulfills(PromiseInterface $promise, $timeout = null } catch (Exception $exception) { $this->fail($failMessage . 'Promise was rejected.'); } - $this->addToAssertionCount(1); } /** @@ -75,13 +75,14 @@ public function assertPromiseFulfillsWith(PromiseInterface $promise, $value, $ti */ public function assertPromiseRejects(PromiseInterface $promise, $timeout = null) { + $this->addToAssertionCount(1); + try { $this->waitForPromise($promise, $timeout); } catch (Exception $exception) { return $exception; } - $this->addToAssertionCount(1); $this->fail('Failed asserting that promise rejects. Promise was fulfilled.'); } @@ -96,9 +97,7 @@ public function assertPromiseRejectsWith(PromiseInterface $promise, $reasonExcep $reason = $this->assertPromiseRejects($promise, $timeout); $this->assertInstanceOf( - $reasonExceptionClass, - $reason, - 'Failed asserting that promise rejects with a specified reason.' + $reasonExceptionClass, $reason, 'Failed asserting that promise rejects with a specified reason.' ); }