From 56a511be8405b67f75cde37e3da2f9a2e7f7564b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Wed, 30 Nov 2022 16:38:34 +0100 Subject: [PATCH] Update CI setup to ensure 100% code coverage --- .github/workflows/ci.yml | 11 +++++++++-- tests/FunctionalClientTest.php | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1105f82..3316db3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,14 @@ jobs: coverage: xdebug ini-file: development - run: composer install - - run: vendor/bin/phpunit --coverage-text + - run: docker pull busybox:latest + - run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml if: ${{ matrix.php >= 7.3 }} - - run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy + - run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml -c phpunit.xml.legacy if: ${{ matrix.php < 7.3 }} + - name: Check 100% code coverage + shell: php {0} + run: | + project->metrics; + exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1); diff --git a/tests/FunctionalClientTest.php b/tests/FunctionalClientTest.php index 3affe99..c34a1c6 100644 --- a/tests/FunctionalClientTest.php +++ b/tests/FunctionalClientTest.php @@ -90,8 +90,7 @@ public function testCreateStartAndRemoveContainer() // get all events between starting and removing for this container $promise = $this->client->events($start, $end, array('container' => array($container['Id']))); $ret = \React\Async\await($promise); - - $this->assertIsArray($ret); + assert(is_array($ret)); $status = array(); // array_column($ret, 'status'); // PHP 5.5+ foreach ($ret as $one) {