| 1 |
Contributing |
| 2 |
==================== |
| 3 |
|
| 4 |
Troubleshooting |
| 5 |
---------------- |
| 6 |
|
| 7 |
PHP 8 CI test is failing: |
| 8 |
:: |
| 9 |
$ ./tools/phpunit MyTest |
| 10 |
PHP Fatal error: Declaration of MyTest::setUp() must be compatible |
| 11 |
with PHPUnit\Framework\TestCase::setUp(): void in ... |
| 12 |
|
| 13 |
To keep compatibility through PHP 5.6 to PHP 8 the setUp method cannot be typed. |
| 14 |
|
| 15 |
Use a homemade methode instead: |
| 16 |
:: |
| 17 |
/** @before **/ |
| 18 |
protected setUpTest() { |
| 19 |
... |
| 20 |
} |
| 21 |
|
| 22 |
How to run the tests |
| 23 |
==================== |
| 24 |
|
| 25 |
Prerequisites: |
| 26 |
-------------- |
| 27 |
|
| 28 |
Download composer and update dev dependencies. |
| 29 |
:: |
| 30 |
|
| 31 |
php composer.phar update |
| 32 |
|
| 33 |
Run the recommended tests: |
| 34 |
-------------------------- |
| 35 |
|
| 36 |
It is recommended to launch these tests at least once to ensure this library will work properly on your configuration. |
| 37 |
:: |
| 38 |
|
| 39 |
vendor/phpunit/phpunit/phpunit --group recommended --exclude-group ignore --bootstrap tests/config.php tests |
| 40 |
|
| 41 |
Run a specific test: |
| 42 |
-------------------- |
| 43 |
|
| 44 |
You can run a specific test adding a filter to the previous command. |
| 45 |
:: |
| 46 |
|
| 47 |
vendor/phpunit/phpunit/phpunit --filter CardTest --group unit --exclude-group ignore --bootstrap tests/config.php tests |
| 48 |
|
| 49 |
Run specific groups of test |
| 50 |
--------------------------- |
| 51 |
|
| 52 |
You can filter tests by groups: |
| 53 |
:: |
| 54 |
|
| 55 |
# Run unit tests |
| 56 |
vendor/phpunit/phpunit/phpunit --group unit --exclude-group ignore --bootstrap tests/config.php tests |
| 57 |
|
| 58 |
# Run functional tests |
| 59 |
vendor/phpunit/phpunit/phpunit --group functional --exclude-group ignore --bootstrap tests/config.php tests |
| 60 |
|
| 61 |
# Run unit tests and functional tests |
| 62 |
vendor/phpunit/phpunit/phpunit --group unit,functional --exclude-group ignore --bootstrap tests/config.php tests |
| 63 |
|