public function PromiseTest::testRecursivelyForwardsWhenOnlyThennable in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/promises/tests/PromiseTest.php \GuzzleHttp\Promise\Tests\PromiseTest::testRecursivelyForwardsWhenOnlyThennable()
File
- vendor/
guzzlehttp/ promises/ tests/ PromiseTest.php, line 504
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testRecursivelyForwardsWhenOnlyThennable() {
$res = [];
$p = new Promise();
$p2 = new Thennable();
$p2
->resolve('foo');
$p2
->then(function ($v) use (&$res) {
$res[] = 'A:' . $v;
});
$p
->then(function () use ($p2, &$res) {
$res[] = 'B';
return $p2;
})
->then(function ($v) use (&$res) {
$res[] = 'C:' . $v;
});
$p
->resolve('a');
$p
->then(function ($v) use (&$res) {
$res[] = 'D:' . $v;
});
P\queue()
->run();
$this
->assertEquals([
'A:foo',
'B',
'D:a',
'C:foo',
], $res);
}