public function EachPromiseTest::testDoesNotBlowStackWithFulfilledPromises in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/promises/tests/EachPromiseTest.php \GuzzleHttp\Promise\Tests\EachPromiseTest::testDoesNotBlowStackWithFulfilledPromises()
File
- vendor/
guzzlehttp/ promises/ tests/ EachPromiseTest.php, line 163
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testDoesNotBlowStackWithFulfilledPromises() {
$pending = [];
for ($i = 0; $i < 100; $i++) {
$pending[] = new FulfilledPromise($i);
}
$values = [];
$each = new EachPromise($pending, [
'fulfilled' => function ($value) use (&$values) {
$values[] = $value;
},
]);
$called = false;
$each
->promise()
->then(function () use (&$called) {
$called = true;
});
$this
->assertFalse($called);
P\queue()
->run();
$this
->assertTrue($called);
$this
->assertEquals(range(0, 99), $values);
}