Skip to content

Commit a5c553a

Browse files
committed
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.
1 parent 9395e8d commit a5c553a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.travis.yml

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

2020
script:
21+
- ./vendor/bin/phpunit -v
2122
- ./vendor/bin/phpunit -v --coverage-text --coverage-clover=./build/logs/clover.xml
2223

2324
after_script:

tests/DeferredTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ 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+
2630
gc_collect_cycles();
2731
$deferred = new Deferred(function ($resolve, $reject) {
2832
$reject(new \Exception('foo'));
@@ -36,6 +40,10 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithEx
3640
/** @test */
3741
public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejectsWithException()
3842
{
43+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
44+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
45+
}
46+
3947
gc_collect_cycles();
4048
$deferred = new Deferred(function ($resolve, $reject) {
4149
$reject(new \Exception('foo'));
@@ -49,6 +57,10 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejects
4957
/** @test */
5058
public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndExplicitlyRejectWithException()
5159
{
60+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
61+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
62+
}
63+
5264
gc_collect_cycles();
5365
$deferred = new Deferred(function () use (&$deferred) { });
5466
$deferred->reject(new \Exception('foo'));

0 commit comments

Comments
 (0)