mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56:05 +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) {
|
foreach ($promisesOrValues as $index => $promiseOrValue) {
|
||||||
if ($promiseOrValue instanceof Promise) {
|
if ($promiseOrValue instanceof Promise) {
|
||||||
|
$result[$index] = null;
|
||||||
$promiseOrValue->then(
|
$promiseOrValue->then(
|
||||||
function($value) use ($index, &$count, $total, &$result, $all) {
|
function($value) use ($index, &$count, $total, &$result, $all) {
|
||||||
$result[$index] = $value;
|
$result[$index] = $value;
|
||||||
|
@ -186,18 +186,18 @@ class SyncPromiseAdapterTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($onFulfilledCalled, false);
|
$this->assertSame($onFulfilledCalled, false);
|
||||||
$this->assertEquals($onRejectedCalled, false);
|
$this->assertSame($onRejectedCalled, false);
|
||||||
|
|
||||||
SyncPromise::runQueue();
|
SyncPromise::runQueue();
|
||||||
|
|
||||||
if ($expectedNextState !== SyncPromise::PENDING) {
|
if ($expectedNextState !== SyncPromise::PENDING) {
|
||||||
$this->assertEquals(!$expectedNextReason, $onFulfilledCalled);
|
$this->assertSame(!$expectedNextReason, $onFulfilledCalled);
|
||||||
$this->assertEquals(!!$expectedNextReason, $onRejectedCalled);
|
$this->assertSame(!!$expectedNextReason, $onRejectedCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals($expectedNextValue, $actualNextValue);
|
$this->assertSame($expectedNextValue, $actualNextValue);
|
||||||
$this->assertEquals($expectedNextReason, $actualNextReason);
|
$this->assertSame($expectedNextReason, $actualNextReason);
|
||||||
$this->assertEquals($expectedNextState, $promise->adoptedPromise->state);
|
$this->assertSame($expectedNextState, $promise->adoptedPromise->state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user