diff --git a/tests/DnsConnectorTest.php b/tests/DnsConnectorTest.php index 15ba1a7..41fdb55 100644 --- a/tests/DnsConnectorTest.php +++ b/tests/DnsConnectorTest.php @@ -293,8 +293,9 @@ public function testRejectionDuringDnsLookupShouldNotCreateAnyGarbageReferences( $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - 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 + } $dns = new Deferred(); $this->resolver->expects($this->once())->method('resolve')->with($this->equalTo('example.com'))->willReturn($dns->promise()); @@ -316,7 +317,9 @@ public function testRejectionAfterDnsLookupShouldNotCreateAnyGarbageReferences() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $dns = new Deferred(); $this->resolver->expects($this->once())->method('resolve')->with($this->equalTo('example.com'))->willReturn($dns->promise()); @@ -341,7 +344,9 @@ public function testRejectionAfterDnsLookupShouldNotCreateAnyGarbageReferencesAg $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $dns = new Deferred(); $this->resolver->expects($this->once())->method('resolve')->with($this->equalTo('example.com'))->willReturn($dns->promise()); @@ -369,7 +374,9 @@ public function testCancelDuringDnsLookupShouldNotCreateAnyGarbageReferences() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $dns = new Deferred(function () { throw new \RuntimeException(); @@ -391,7 +398,9 @@ public function testCancelDuringTcpConnectionShouldNotCreateAnyGarbageReferences $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $dns = new Deferred(); $this->resolver->expects($this->once())->method('resolve')->with($this->equalTo('example.com'))->willReturn($dns->promise()); diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index fec5810..4d9c804 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -126,8 +126,9 @@ public function testCancellingPendingConnectionWithoutTimeoutShouldNotCreateAnyG $connector = new Connector(array('timeout' => false)); - 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 = $connector->connect('8.8.8.8:80'); $promise->cancel(); @@ -144,7 +145,10 @@ public function testCancellingPendingConnectionShouldNotCreateAnyGarbageReferenc $connector = new Connector(array()); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } + $promise = $connector->connect('8.8.8.8:80'); $promise->cancel(); unset($promise); @@ -167,7 +171,9 @@ public function testWaitingForRejectedConnectionShouldNotCreateAnyGarbageReferen $connector = new Connector(array('timeout' => false)); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $wait = true; $promise = $connector->connect('127.0.0.1:1')->then( @@ -201,7 +207,9 @@ public function testWaitingForConnectionTimeoutDuringDnsLookupShouldNotCreateAny $connector = new Connector(array('timeout' => 0.001)); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $wait = true; $promise = $connector->connect('google.com:80')->then( @@ -232,7 +240,9 @@ public function testWaitingForConnectionTimeoutDuringTcpConnectionShouldNotCreat $connector = new Connector(array('timeout' => 0.000001)); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $wait = true; $promise = $connector->connect('8.8.8.8:53')->then( @@ -263,7 +273,9 @@ public function testWaitingForInvalidDnsConnectionShouldNotCreateAnyGarbageRefer $connector = new Connector(array('timeout' => false)); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $wait = true; $promise = $connector->connect('example.invalid:80')->then( @@ -304,7 +316,9 @@ public function testWaitingForInvalidTlsConnectionShouldNotCreateAnyGarbageRefer ) )); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $wait = true; $promise = $connector->connect('tls://self-signed.badssl.com:443')->then( @@ -338,7 +352,10 @@ public function testWaitingForSuccessfullyClosedConnectionShouldNotCreateAnyGarb $connector = new Connector(array('timeout' => false)); - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } + $promise = $connector->connect('google.com:80')->then( function ($conn) { $conn->close(); diff --git a/tests/SecureConnectorTest.php b/tests/SecureConnectorTest.php index cfd0977..e81f4a9 100644 --- a/tests/SecureConnectorTest.php +++ b/tests/SecureConnectorTest.php @@ -258,14 +258,15 @@ public function testRejectionDuringConnectionShouldNotCreateAnyGarbageReferences $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - 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 + } $tcp = new Deferred(); $this->tcp->expects($this->once())->method('connect')->willReturn($tcp->promise()); $promise = $this->connector->connect('example.com:80'); - + $promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection $tcp->reject(new \RuntimeException()); @@ -280,7 +281,9 @@ public function testRejectionDuringTlsHandshakeShouldNotCreateAnyGarbageReferenc $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $connection = $this->getMockBuilder('React\Socket\Connection')->disableOriginalConstructor()->getMock(); diff --git a/tests/TcpConnectorTest.php b/tests/TcpConnectorTest.php index ede2070..fb6f871 100644 --- a/tests/TcpConnectorTest.php +++ b/tests/TcpConnectorTest.php @@ -372,8 +372,9 @@ public function testCancelDuringConnectionShouldNotCreateAnyGarbageReferences() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - 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 + } $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); $connector = new TcpConnector($loop); diff --git a/tests/TimeoutConnectorTest.php b/tests/TimeoutConnectorTest.php index fa97de4..fc218c4 100644 --- a/tests/TimeoutConnectorTest.php +++ b/tests/TimeoutConnectorTest.php @@ -199,7 +199,9 @@ public function testRejectionDuringConnectionShouldNotCreateAnyGarbageReferences $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $connection = new Deferred(); $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); @@ -223,7 +225,9 @@ public function testRejectionDueToTimeoutShouldNotCreateAnyGarbageReferences() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } - gc_collect_cycles(); + while (gc_collect_cycles()) { + // collect all garbage cycles + } $connection = new Deferred(function () { throw new \RuntimeException('Connection cancelled'); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy