phpunit.xml or a custom Artisan command).Testing facade if not isolated (e.g., avoiding Assert namespace collisions).--min-shrinks or parallelize tests.tests/ directory alongside Feature/Unit tests. Use a custom namespace (e.g., Property) to avoid collisions.Application class as a singleton or bind it to a custom test service provider for reusable test configurations.php artisan blackbox:run) to execute PBT proofs, optionally with flags for parallelism or coverage thresholds.LaravelBlackBox) to abstract BlackBox’s API (e.g., Proof::forModel(User::class)).blackbox.php config file for global settings (e.g., default shrinking limits, parallel workers).DatabaseMigrations or DatabaseTransactions traits alongside PBT to test database interactions (e.g., "summing order items preserves totals").Mockery or PHPUnit’s mocking to isolate dependencies in proofs (e.g., mocking an external API to test retry logic).Set::custom() for domain-specific value generators (e.g., valid/invalid email formats).composer.json and phpunit.xml:
<listeners>
<listener class="Innmind\BlackBox\Listener" />
</listeners>
PropertyTestCase base class to standardize proof structure.- name: Run BlackBox Proofs
run: php artisan blackbox:run --parallel --min-shrinks=3
Set::shrinking() to automatically refine test cases when properties change.Set::integers() bounds).--workers=N to parallelize proofs in CI (e.g., 4 workers for a 10-minute timeout).Set::laravelModelInstances()).| Failure Type | Root Cause | Mitigation |
|---|---|---|
| Proof hangs | Infinite shrinking or large input space | Set bounds (e.g., Set::integers()->between(-1000, 1000)), add timeouts. |
| Flaky proofs | Non-deterministic dependencies | Mock external systems; use DatabaseTransactions. |
| False negatives | Overly strict properties | Relax constraints or add exceptions (e.g., ->unless(fn($x) => $x->isEdgeCase())). |
| CI pipeline slowdown | Too many proofs or large test sets | Run proofs in parallel; sample inputs with --samples=1000. |
| Low adoption | Perceived complexity | Start with "quick wins" (e.g., proofs for pure functions). |
How can I help you explore Laravel packages today?