Skip to content

Commit 66a6273

Browse files
committed
Update CI setup to ensure 100% code coverage
1 parent c37981a commit 66a6273

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ jobs:
3030
php-version: ${{ matrix.php }}
3131
coverage: xdebug
3232
- run: composer install
33-
- run: vendor/bin/phpunit --coverage-text
33+
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml
3434
if: ${{ matrix.php >= 7.3 }}
35-
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
35+
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml -c phpunit.xml.legacy
3636
if: ${{ matrix.php < 7.3 }}
37+
- name: Check 100% code coverage
38+
shell: php {0}
39+
run: |
40+
<?php
41+
$metrics = simplexml_load_file('clover.xml')->project->metrics;
42+
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1);
3743
3844
PHPUnit-hhvm:
3945
name: PHPUnit (HHVM)

src/Decoder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public function handleData($data)
116116
if ($this->options === 0) {
117117
$data = \json_decode($data, $this->assoc, $this->depth);
118118
} else {
119-
$data = \json_decode($data, $this->assoc, $this->depth, $this->options);
119+
assert(\PHP_VERSION_ID >= 50400);
120+
$data = \json_decode($data, $this->assoc, $this->depth, $this->options); // @codeCoverageIgnore
120121
}
121122

122123
// abort stream if decoding failed

0 commit comments

Comments
 (0)