Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
seregazhuk committed Sep 14, 2018
2 parents e372d03 + 2d9771b commit 3939372
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -41,7 +42,6 @@ public function assertPromiseFulfills(PromiseInterface $promise, $timeout = null
} catch (Exception $exception) {
$this->fail($failMessage . 'Promise was rejected.');
}
$this->addToAssertionCount(1);
}

/**
Expand Down Expand Up @@ -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.');
}

Expand All @@ -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.'
);
}

Expand Down

0 comments on commit 3939372

Please sign in to comment.