From 9395e8d9f5a9bad68edab2d8b81f9e5bb28073f6 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 1 Feb 2020 12:20:28 +0100 Subject: [PATCH 1/2] Test PHP 7.4 on Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index bd2ae443..12b6dd49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 7.1 - 7.2 - 7.3 + - 7.4 - nightly # ignore errors, see below # lock distro so new future defaults will not break the build From a5c553a3d0c543f7a86422255f5343d07e5514f4 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 15 Feb 2020 19:16:05 +0100 Subject: [PATCH 2/2] Run tests twice, once with, and once without coverage We're doing this because certain tests have memory leaks only when code coverage is collected. --- .travis.yml | 1 + tests/DeferredTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/.travis.yml b/.travis.yml index 12b6dd49..ddac7a86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ install: - composer install script: + - ./vendor/bin/phpunit -v - ./vendor/bin/phpunit -v --coverage-text --coverage-clover=./build/logs/clover.xml after_script: diff --git a/tests/DeferredTest.php b/tests/DeferredTest.php index 172cb246..861dd576 100644 --- a/tests/DeferredTest.php +++ b/tests/DeferredTest.php @@ -23,6 +23,10 @@ public function getPromiseTestAdapter(callable $canceller = null) /** @test */ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithException() { + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $deferred = new Deferred(function ($resolve, $reject) { $reject(new \Exception('foo')); @@ -36,6 +40,10 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithEx /** @test */ public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejectsWithException() { + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $deferred = new Deferred(function ($resolve, $reject) { $reject(new \Exception('foo')); @@ -49,6 +57,10 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejects /** @test */ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndExplicitlyRejectWithException() { + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $deferred = new Deferred(function () use (&$deferred) { }); $deferred->reject(new \Exception('foo'));