public function testApiAlways_RejectsPromise_WhenHandlerRejects_AfterReject()
{
$deferred = $this->createDeferred();
$test = $this->getTest();
$exception = new Exception();
$mock = $test->createCallableMock();
$mock->expects($test->once())->method('__invoke')->with($test->identicalTo($exception));
$deferred->getPromise()->always(function () use($exception) {
return Promise::doReject($exception);
})->then(null, $mock);
$deferred->reject($exception);
}