Skip to content

Preserve the order of the array with all and map functions #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

lordthorzonus
Copy link

fixes #74

I added the changelog entry for the 2.5.x heading (not sure if this is correct).

@lordthorzonus lordthorzonus changed the base branch from master to 2.x December 22, 2016 10:24
call_user_func($queue->dequeue());

$this->assertSame([1, 2, 3], $result);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the style of the test matching the rest of the tests. In this case this would something like

/** @test */
public function shouldPreserveTheOrderOfArrayWhenResolvingAsyncPromises()
{
    $deferred = new Deferred();

    $mock = $this->createCallableMock();
    $mock
        ->expects($this->once())
        ->method('__invoke')
        ->with($this->identicalTo([1, 2, 3]));

    all([1, $deferred->promise(), 3])
        ->then($mock);

    $deferred->resolve(2);
}

$this->assertSame([2 ,4 ,6], $result);
}

/** @test */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the style of the test matching the rest of the tests (see my comment on the all test).

@lordthorzonus
Copy link
Author

@jsor Unified the test style. Sorry about that :).

@jsor jsor merged commit 53799ed into reactphp:2.x Dec 22, 2016
@jsor
Copy link
Member

jsor commented Dec 22, 2016

Awesome, thanks a lot @lordthorzonus!

@jsor
Copy link
Member

jsor commented Dec 22, 2016

Released in v2.5.0.

@clue clue added this to the v2.5 milestone Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

\React\Promise\all not preserving array key order
4 participants