public function doneShouldThrowWithDeepNestingPromiseChains()
{
$this->setExpectedException('\\Exception', 'UnhandledRejectionException');
$exception = new \Exception('UnhandledRejectionException');
$d = new Deferred();
$result = \React\Promise\resolve(\React\Promise\resolve($d->promise()->then(function () use($exception) {
$d = new Deferred();
$d->resolve();
return \React\Promise\resolve($d->promise()->then(function () {
}))->then(function () use($exception) {
throw $exception;
});
})));
$result->done();
$d->resolve();
}