Skip to content

Commit 5dd458b

Browse files
committed
Add test for resolver throwing
1 parent 1362cec commit 5dd458b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/React/Promise/PromiseTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ public function shouldThrowIfResolverIsNotACallable()
1414

1515
new Promise(null);
1616
}
17+
/** @test */
18+
public function shouldRejectIfResolverThrows()
19+
{
20+
$e = new \Exception();
21+
22+
$promise = new Promise(function() use($e) {
23+
throw $e;
24+
});
25+
26+
$mock = $this->createCallableMock();
27+
$mock
28+
->expects($this->once())
29+
->method('__invoke')
30+
->with($this->identicalTo($e));
31+
32+
$promise->then($this->expectCallableNever(), $mock);
33+
}
1734

1835
/** @test */
1936
public function shouldResolve()

0 commit comments

Comments
 (0)