public function then(callable $onFulfilled = null, callable $onRejected = null)
{
return $this->promise()->then($onFulfilled, $onRejected);
}
/** @test */ 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); }