public function EachPromiseTest::testInvokesAllPromises in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/promises/tests/EachPromiseTest.php \GuzzleHttp\Promise\Tests\EachPromiseTest::testInvokesAllPromises()
File
- vendor/
guzzlehttp/ promises/ tests/ EachPromiseTest.php, line 22
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testInvokesAllPromises() {
$promises = [
new Promise(),
new Promise(),
new Promise(),
];
$called = [];
$each = new EachPromise($promises, [
'fulfilled' => function ($value) use (&$called) {
$called[] = $value;
},
]);
$p = $each
->promise();
$promises[0]
->resolve('a');
$promises[1]
->resolve('c');
$promises[2]
->resolve('b');
P\queue()
->run();
$this
->assertEquals([
'a',
'c',
'b',
], $called);
$this
->assertEquals(PromiseInterface::FULFILLED, $p
->getState());
}