Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions tests/FunctionalResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ public function testResolveShouldNotCauseGarbageReferencesWhenUsingInvalidNamese
$factory = new Factory();
$this->resolver = $factory->create('255.255.255.255');

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->resolver->resolve('google.com');

Expand All @@ -204,8 +205,9 @@ public function testResolveCachedShouldNotCauseGarbageReferencesWhenUsingInvalid
$factory = new Factory();
$this->resolver = $factory->createCached('255.255.255.255');

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->resolver->resolve('google.com');

Expand All @@ -225,8 +227,9 @@ public function testCancelResolveShouldNotCauseGarbageReferences()
$factory = new Factory();
$this->resolver = $factory->create('127.0.0.1');

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->resolver->resolve('google.com');
$promise->cancel();
Expand All @@ -244,8 +247,9 @@ public function testCancelResolveCachedShouldNotCauseGarbageReferences()
$factory = new Factory();
$this->resolver = $factory->createCached('127.0.0.1');

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->resolver->resolve('google.com');
$promise->cancel();
Expand Down
5 changes: 3 additions & 2 deletions tests/Query/CoopExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ public function testCancelQueryShouldNotCauseGarbageReferences()
$base->expects($this->once())->method('query')->willReturn($deferred->promise());
$connector = new CoopExecutor($base);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('reactphp.org', Message::TYPE_A, Message::CLASS_IN);

Expand Down
10 changes: 6 additions & 4 deletions tests/Query/FallbackExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ public function testCancelQueryShouldNotCauseGarbageReferencesWhenCancellingPrim

$executor = new FallbackExecutor($primary, $secondary);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('reactphp.org', Message::TYPE_A, Message::CLASS_IN);

Expand All @@ -210,8 +211,9 @@ public function testCancelQueryShouldNotCauseGarbageReferencesWhenCancellingSeco

$executor = new FallbackExecutor($primary, $secondary);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('reactphp.org', Message::TYPE_A, Message::CLASS_IN);

Expand Down
20 changes: 12 additions & 8 deletions tests/Query/RetryExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ public function queryShouldNotCauseGarbageReferencesOnSuccess()

$retryExecutor = new RetryExecutor($executor, 0);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN);
$retryExecutor->query($query);
Expand All @@ -254,8 +255,9 @@ public function queryShouldNotCauseGarbageReferencesOnTimeoutErrors()

$retryExecutor = new RetryExecutor($executor, 0);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN);
$promise = $retryExecutor->query($query);
Expand Down Expand Up @@ -288,8 +290,9 @@ public function queryShouldNotCauseGarbageReferencesOnCancellation()

$retryExecutor = new RetryExecutor($executor, 0);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN);
$promise = $retryExecutor->query($query);
Expand Down Expand Up @@ -320,8 +323,9 @@ public function queryShouldNotCauseGarbageReferencesOnNonTimeoutErrors()

$retryExecutor = new RetryExecutor($executor, 2);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN);
$promise = $retryExecutor->query($query);
Expand Down
15 changes: 9 additions & 6 deletions tests/Query/SelectiveTransportExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ public function testCancelPromiseShouldNotCreateAnyGarbageReferences()
throw new \RuntimeException('Cancelled');
}));

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->executor->query($query);
$promise->cancel();
Expand Down Expand Up @@ -195,8 +196,9 @@ public function testCancelPromiseAfterTruncatedResponseShouldNotCreateAnyGarbage
throw new \RuntimeException('Cancelled');
}));

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->executor->query($query);
$deferred->reject(new \RuntimeException('', defined('SOCKET_EMSGSIZE') ? SOCKET_EMSGSIZE : 90));
Expand All @@ -222,8 +224,9 @@ public function testRejectedPromiseAfterTruncatedResponseShouldNotCreateAnyGarba
->with($query)
->willReturn(\React\Promise\reject(new \RuntimeException()));

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on
while (gc_collect_cycles()) {
// collect all garbage cycles
}

$promise = $this->executor->query($query);

Expand Down