/**
  * Test always.
  *
  * @param PromiseInterface $promise
  *
  * @dataProvider promiseDataProvider
  */
 public function testAlways(PromiseInterface $promise)
 {
     $this->given($promise, $onFulfilledOrRejected = $this->delegateMock(), $onNotify = $this->delegateMock())->when($always = $promise->always($onFulfilledOrRejected, $onNotify))->then()->object($always)->isInstanceOf(PromiseInterface::class)->boolean($promise->state()->equals($always->state()))->isTrue();
     if ($promise->state()->equals(State::FULFILLED())) {
         $this->given($value = $this->defaultResolveValue())->then()->delegateCall($onFulfilledOrRejected)->withArguments($value)->once();
     }
     if ($promise->state()->equals(State::REJECTED())) {
         $this->given($reason = $this->defaultRejectReason())->then()->delegateCall($onFulfilledOrRejected)->withArguments($reason)->once();
     }
 }
 /**
  * Test reject.
  */
 public function testReject()
 {
     $this->given($deferred = $this->newDefaultTestedInstance(), $reason = new \Exception())->when($deferred->reject($reason))->then()->boolean($deferred->promise()->state()->equals(State::REJECTED()))->isTrue();
     $this->given($onRejected = $this->delegateMock())->when($deferred->promise()->then(null, $onRejected))->then()->delegateCall($onRejected)->withArguments($reason)->once();
     $this->invalidActionTest($deferred);
 }