Skip to content

Commit 8cda17d

Browse files
authored
Merge pull request #143 from clue-labs/update-tests
Update test environment and dev dependencies
2 parents 581b27c + 33ed63d commit 8cda17d

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

README.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# clue/reactphp-redis
22

33
[![CI status](https://github.com/clue/reactphp-redis/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-redis/actions)
4+
[![code coverage](https://img.shields.io/badge/code%20coverage-100%25-success)](#tests)
5+
[![PHPStan level](https://img.shields.io/badge/PHPStan%20level-max-success)](#tests)
46
[![installs on Packagist](https://img.shields.io/packagist/dt/clue/redis-react?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/redis-react)
57

68
Async [Redis](https://redis.io/) client implementation, built on top of [ReactPHP](https://reactphp.org/).
@@ -496,7 +498,7 @@ Once released, this project will follow [SemVer](https://semver.org/).
496498
At the moment, this will install the latest development version:
497499

498500
```bash
499-
$ composer require clue/redis-react:^3@dev
501+
composer require clue/redis-react:^3@dev
500502
```
501503

502504
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
@@ -510,7 +512,7 @@ smooth upgrade path. You may target multiple versions at the same time to
510512
support a wider range of PHP versions like this:
511513

512514
```bash
513-
$ composer require "clue/redis-react:^3@dev || ^2"
515+
composer require "clue/redis-react:^3@dev || ^2"
514516
```
515517

516518
## Tests
@@ -519,13 +521,21 @@ To run the test suite, you first need to clone this repo and then install all
519521
dependencies [through Composer](https://getcomposer.org/):
520522

521523
```bash
522-
$ composer install
524+
composer install
523525
```
524526

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

527529
```bash
528-
$ vendor/bin/phpunit
530+
vendor/bin/phpunit
531+
```
532+
533+
The test suite is set up to always ensure 100% code coverage across all
534+
supported environments. If you have the Xdebug extension installed, you can also
535+
generate a code coverage report locally like this:
536+
537+
```bash
538+
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
529539
```
530540

531541
The test suite contains both unit tests and functional integration tests.
@@ -535,14 +545,20 @@ and will be skipped by default.
535545
If you don't have access to a running Redis server, you can also use a temporary `Redis` Docker image:
536546

537547
```bash
538-
$ docker run --net=host redis
548+
docker run --net=host redis
539549
```
540550

541551
To now run the functional tests, you need to supply *your* login
542552
details in an environment variable like this:
543553

544554
```bash
545-
$ REDIS_URI=localhost:6379 vendor/bin/phpunit
555+
REDIS_URI=localhost:6379 vendor/bin/phpunit
556+
```
557+
558+
On top of this, we use PHPStan on max level to ensure type safety across the project:
559+
560+
```bash
561+
vendor/bin/phpstan
546562
```
547563

548564
## License

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
},
2222
"require-dev": {
2323
"clue/block-react": "^1.5",
24-
"phpstan/phpstan": "1.9.2 || 1.4.10",
25-
"phpunit/phpunit": "^9.5 || ^7.5"
24+
"phpstan/phpstan": "1.10.15 || 1.4.10",
25+
"phpunit/phpunit": "^9.6 || ^7.5"
2626
},
2727
"autoload": {
2828
"psr-4": { "Clue\\React\\Redis\\": "src/" }

phpunit.xml.dist

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!-- PHPUnit configuration file with new format for PHPUnit 9.5+ -->
3+
<!-- PHPUnit configuration file with new format for PHPUnit 9.6+ -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
66
bootstrap="vendor/autoload.php"
77
cacheResult="false"
88
colors="true"
@@ -20,7 +20,7 @@
2020
<php>
2121
<ini name="error_reporting" value="-1" />
2222
<!-- Evaluate assertions, requires running with "php -d zend.assertions=1 vendor/bin/phpunit" -->
23-
<!-- <ini name="zend.assertions=1" value="1" /> -->
23+
<!-- <ini name="zend.assertions" value="1" /> -->
2424
<ini name="assert.active" value="1" />
2525
<ini name="assert.exception" value="1" />
2626
<ini name="assert.bail" value="0" />

phpunit.xml.legacy

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<php>
1919
<ini name="error_reporting" value="-1" />
2020
<!-- Evaluate assertions, requires running with "php -d zend.assertions=1 vendor/bin/phpunit" -->
21-
<!-- <ini name="zend.assertions=1" value="1" /> -->
21+
<!-- <ini name="zend.assertions" value="1" /> -->
2222
<ini name="assert.active" value="1" />
2323
<ini name="assert.exception" value="1" />
2424
<ini name="assert.bail" value="0" />

0 commit comments

Comments
 (0)