public function testApiAlways_RejectsPromise_WhenHandlerThrows_ForRejectedPromise()
{
$deferred = $this->createDeferred();
$test = $this->getTest();
$ex1 = new Exception();
$ex2 = new Exception();
$mock = $test->createCallableMock();
$mock->expects($test->once())->method('__invoke')->with($test->identicalTo($ex2));
$deferred->reject($ex1);
$deferred->getPromise()->always(function () use($ex2) {
throw $ex2;
})->then(null, $mock);
}