mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 14:26:08 +03:00
Fixed SyncPromiseAdapter::all() to not change the order of arrays
This commit is contained in:
parent
ed41a4ce43
commit
e35b57601d
@ -96,6 +96,7 @@ class SyncPromiseAdapter implements PromiseAdapter
|
||||
|
||||
foreach ($promisesOrValues as $index => $promiseOrValue) {
|
||||
if ($promiseOrValue instanceof Promise) {
|
||||
$result[$index] = null;
|
||||
$promiseOrValue->then(
|
||||
function($value) use ($index, &$count, $total, &$result, $all) {
|
||||
$result[$index] = $value;
|
||||
|
@ -186,18 +186,18 @@ class SyncPromiseAdapterTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
);
|
||||
|
||||
$this->assertEquals($onFulfilledCalled, false);
|
||||
$this->assertEquals($onRejectedCalled, false);
|
||||
$this->assertSame($onFulfilledCalled, false);
|
||||
$this->assertSame($onRejectedCalled, false);
|
||||
|
||||
SyncPromise::runQueue();
|
||||
|
||||
if ($expectedNextState !== SyncPromise::PENDING) {
|
||||
$this->assertEquals(!$expectedNextReason, $onFulfilledCalled);
|
||||
$this->assertEquals(!!$expectedNextReason, $onRejectedCalled);
|
||||
$this->assertSame(!$expectedNextReason, $onFulfilledCalled);
|
||||
$this->assertSame(!!$expectedNextReason, $onRejectedCalled);
|
||||
}
|
||||
|
||||
$this->assertEquals($expectedNextValue, $actualNextValue);
|
||||
$this->assertEquals($expectedNextReason, $actualNextReason);
|
||||
$this->assertEquals($expectedNextState, $promise->adoptedPromise->state);
|
||||
$this->assertSame($expectedNextValue, $actualNextValue);
|
||||
$this->assertSame($expectedNextReason, $actualNextReason);
|
||||
$this->assertSame($expectedNextState, $promise->adoptedPromise->state);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user