React\Promise\LazyPromise::then PHP Method

then() public method

public then ( callable $onFulfilled = null, callable $onRejected = null )
$onFulfilled callable
$onRejected callable
    public function then(callable $onFulfilled = null, callable $onRejected = null)
    {
        return $this->promise()->then($onFulfilled, $onRejected);
    }

Usage Example

示例#1
0
 /** @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);
 }
All Usage Examples Of React\Promise\LazyPromise::then