public function PromiseTest::testRemovesReferenceFromChildWhenParentWaitedUpon in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/promises/tests/PromiseTest.php \GuzzleHttp\Promise\Tests\PromiseTest::testRemovesReferenceFromChildWhenParentWaitedUpon()
File
- vendor/
guzzlehttp/ promises/ tests/ PromiseTest.php, line 440
Class
Namespace
GuzzleHttp\Promise\TestsCode
public function testRemovesReferenceFromChildWhenParentWaitedUpon() {
$r = null;
$p = new Promise(function () use (&$p) {
$p
->resolve('a');
});
$p2 = new Promise(function () use (&$p2) {
$p2
->resolve('b');
});
$pb = $p
->then(function ($v) use ($p2, &$r) {
$r = $v;
return $p2;
})
->then(function ($v) {
return $v . '.';
});
$this
->assertEquals('a', $p
->wait());
$this
->assertEquals('b', $p2
->wait());
$this
->assertEquals('b.', $pb
->wait());
$this
->assertEquals('a', $r);
}