Skip to content

Commit

Permalink
Merge pull request #18 from clue-labs/coverage
Browse files Browse the repository at this point in the history
Update test suite to ensure 100% code coverage
  • Loading branch information
clue authored Aug 5, 2024
2 parents dc8c965 + d2c2a71 commit 13e40f8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ jobs:
php-version: ${{ matrix.php }}
coverage: xdebug
- run: composer install
- run: vendor/bin/phpunit --coverage-text
- 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: |
<?php
$metrics = simplexml_load_file('clover.xml')->project->metrics;
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1);
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# clue/redis-protocol

[![CI status](https://github.com/clue/redis-protocol/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/redis-protocol/actions)
[![code coverage](https://img.shields.io/badge/code%20coverage-100%25-success)](#tests)
[![installs on Packagist](https://img.shields.io/packagist/dt/clue/redis-protocol?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/redis-protocol)

A streaming Redis protocol (RESP) parser and serializer written in pure PHP.
Expand All @@ -26,6 +27,7 @@ implementations.
* [Model](#model)
* [Serializer](#serializer)
* [Install](#install)
* [Tests](#tests)
* [License](#license)

## Support us
Expand Down Expand Up @@ -139,11 +141,34 @@ The recommended way to install this library is [through Composer](https://getcom
This will install the latest supported version:

```bash
$ composer require clue/redis-protocol:^0.3.1
composer require clue/redis-protocol:^0.3.1
```

More details and upgrade guides can be found in the [CHANGELOG](CHANGELOG.md).

## Tests

To run the test suite, you first need to clone this repo and then install all
dependencies [through Composer](https://getcomposer.org/):

```bash
composer install
```

To run the test suite, go to the project root and run:

```bash
vendor/bin/phpunit
```

The test suite is set up to always ensure 100% code coverage across all
supported environments. If you have the Xdebug extension installed, you can also
generate a code coverage report locally like this:

```bash
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
```

## License

Its parser and serializer originally used to be based on
Expand Down
1 change: 0 additions & 1 deletion src/Clue/Redis/Protocol/Parser/ResponseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ private function readResponse()
break;
default:
throw new ParserException('Invalid message can not be parsed: "' . $reply . '"');
break;
}
/* Party on */
return $response;
Expand Down

0 comments on commit 13e40f8

Please sign in to comment.