Download the PHP package boltci/shards without Composer
On this page you can find all versions of the php package boltci/shards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download boltci/shards
More information about boltci/shards
Files in boltci/shards
Package shards
Short Description Patch PHPUnit and Paratest to shard your Laravel test suite.
License MIT
Informations about the package shards
Shards
Patch PHPUnit and Paratest to shard your Laravel test suite.
Caveats
Both Pest (as of version 4.0.0) and ParaTest (as of version 7.13.0) support test sharding natively, in more robust ways than this package provides.
You should only use this as a last resort if your version of testing framework does not support sharding natively.
Supported Versions
- PHP 8.2 or higher
- Laravel 10.x or higher
- PHPUnit 10.x or higher
- ParaTest 7.2.0 or higher
Installation
Install the package via Composer:
Usage
1. Patch PHPUnit
Before running your tests, patch PHPUnit to enable sharding:
This command modifies the PHPUnit test suite builder to shard tests based on your environment configuration.
2. Patch ParaTest
If you're using ParaTest versions between 7.2.0 and 7.4.2, you may need to apply a compatibility patch:
Note: ParaTest 7.4.3 and above have the issue fixed and don't require patching.
3. Run Your Tests
Run your tests with the SHARD environment variable set to specify which shard to run. The format is x/y,
where x is the shard number and y is the total number of shards.
You can optionally set the SEED variable to any positive integers to shuffle the test order using a
deterministic seed (i.e. the same seed will always produce the same test order):
When using ParaTest (by passing --parallel), include the --functional flag to parallelize by Test to avoid overlaps
between shards:
This is useful to help distribute tests more evenly across shards.
Credits
- The first version of this code was first written for internal use at Springloaded.
- The use of the word "shard" and the "x/y" shard notation was later adapted from Pest.
License
The MIT License (MIT). Please see License File for more information.
All versions of shards with dependencies
illuminate/testing Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
brianium/paratest Version ^7.2.0