You are here

public function EachPromiseTest::testClearsReferencesWhenResolved in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/promises/tests/EachPromiseTest.php \GuzzleHttp\Promise\Tests\EachPromiseTest::testClearsReferencesWhenResolved()

File

vendor/guzzlehttp/promises/tests/EachPromiseTest.php, line 137

Class

EachPromiseTest
@covers GuzzleHttp\Promise\EachPromise

Namespace

GuzzleHttp\Promise\Tests

Code

public function testClearsReferencesWhenResolved() {
  $called = false;
  $a = new Promise(function () use (&$a, &$called) {
    $a
      ->resolve('a');
    $called = true;
  });
  $each = new EachPromise([
    $a,
  ], [
    'concurrency' => function () {
      return 1;
    },
    'fulfilled' => function () {
    },
    'rejected' => function () {
    },
  ]);
  $each
    ->promise()
    ->wait();
  $this
    ->assertNull($this
    ->readAttribute($each, 'onFulfilled'));
  $this
    ->assertNull($this
    ->readAttribute($each, 'onRejected'));
  $this
    ->assertNull($this
    ->readAttribute($each, 'iterable'));
  $this
    ->assertNull($this
    ->readAttribute($each, 'pending'));
  $this
    ->assertNull($this
    ->readAttribute($each, 'concurrency'));
  $this
    ->assertTrue($called);
}