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