Skip to content

Commit acee913

Browse files
committed
Clear garbage references twice before starting tests
Clear twice to avoid leftovers in PHP 7.4 with ext-debug and code coverage turned on (`vendor/bin/phpunit --coverage-text`).
1 parent af7fa59 commit acee913

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ install:
1818
- composer install
1919

2020
script:
21-
- ./vendor/bin/phpunit -v
2221
- ./vendor/bin/phpunit -v --coverage-text --coverage-clover=./build/logs/clover.xml
2322

2423
after_script:

tests/DeferredTest.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public function getPromiseTestAdapter(callable $canceller = null)
2323
/** @test */
2424
public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithException()
2525
{
26-
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
27-
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
28-
}
29-
3026
gc_collect_cycles();
3127
$deferred = new Deferred(function ($resolve, $reject) {
3228
$reject(new \Exception('foo'));
@@ -40,11 +36,9 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithEx
4036
/** @test */
4137
public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejectsWithException()
4238
{
43-
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
44-
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
45-
}
46-
4739
gc_collect_cycles();
40+
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-debug and code coverage turned on
41+
4842
$deferred = new Deferred(function ($resolve, $reject) {
4943
$reject(new \Exception('foo'));
5044
});
@@ -57,11 +51,9 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejects
5751
/** @test */
5852
public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndExplicitlyRejectWithException()
5953
{
60-
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
61-
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
62-
}
63-
6454
gc_collect_cycles();
55+
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-debug and code coverage turned on
56+
6557
$deferred = new Deferred(function () use (&$deferred) { });
6658
$deferred->reject(new \Exception('foo'));
6759
unset($deferred);

0 commit comments

Comments
 (0)