public function shouldReturnRejectedPromiseIfFactoryThrowsException()
{
$exception = new \Exception();
$factory = $this->createCallableMock();
$factory->expects($this->once())->method('__invoke')->will($this->throwException($exception));
$onRejected = $this->createCallableMock();
$onRejected->expects($this->once())->method('__invoke')->with($this->identicalTo($exception));
$p = new LazyPromise($factory);
$p->then($this->expectCallableNever(), $onRejected);
}