# Install dependencies
composer install
# Run unit/feature tests (mocks, no Redis needed)
./vendor/bin/phpunit
# Run specific test suite
./vendor/bin/phpunit --testsuite=Feature
./vendor/bin/phpunit --testsuite=UnitIntegration tests require a running Redis instance.
# Start Redis on port 6380
docker compose -f docker-compose.test.yml up -d
# Run integration tests
REDIS_INTEGRATION=1 REDIS_PORT=6380 ./vendor/bin/phpunit --testsuite=Integration
# Stop Redis when done
docker compose -f docker-compose.test.yml downIf you have Redis running locally on default port:
REDIS_INTEGRATION=1 REDIS_PORT=6379 ./vendor/bin/phpunit --testsuite=Integration| Variable | Default | Description |
|---|---|---|
REDIS_INTEGRATION |
- | Set to 1 to enable integration tests |
REDIS_HOST |
127.0.0.1 |
Redis host |
REDIS_PORT |
6380 |
Redis port |
REDIS_DB |
15 |
Redis database (uses separate DB to avoid conflicts) |
# Run single test method
./vendor/bin/phpunit --filter=test_push_job_creates_partition
# Run single test class
./vendor/bin/phpunit tests/Feature/StrategyTest.php
# Run with verbose output
./vendor/bin/phpunit -v
# Run with coverage (requires xdebug or pcov)
./vendor/bin/phpunit --coverage-html=build/coverageGitHub Actions runs both unit and integration tests automatically on push/PR.
See .github/workflows/tests.yml for configuration.
tests/
├── TestCase.php # Base test case with mocks
├── Feature/ # Feature tests (with mocks)
│ ├── BalancedDispatchableTest.php
│ ├── LimiterTest.php
│ ├── MetricsTest.php
│ ├── PrometheusTest.php
│ ├── IpWhitelistTest.php
│ └── StrategyTest.php
└── Integration/ # Integration tests (real Redis)
├── IntegrationTestCase.php
├── BalancedQueueIntegrationTest.php # Core queue tests
├── CommandsIntegrationTest.php # Artisan commands
├── PrometheusIntegrationTest.php # Metrics endpoint
├── TestJob.php
└── TestJobWithNumericPartition.php
| Component | Unit/Feature | Integration |
|---|---|---|
| Strategies | ✅ | ✅ |
| BalancedDispatchable | ✅ | ✅ |
| Limiters | ✅ | ✅ |
| Metrics | ✅ | ✅ |
| BalancedRedisQueue | - | ✅ |
| Console commands | - | ✅ |
| PrometheusExporter | ✅ | ✅ |