graham-campbell/testbench-core
Core testing utilities for Laravel packages, maintained by Graham Campbell. Provides lightweight TestBench components compatible with Laravel 8–13, PHP 7.4–8.5, and PHPUnit 9–12 to simplify package test setup and integration.
Build vs. Buy Decision:
Roadmap & Tech Debt Reduction:
MockeryTrait for legacy codebases). Enables gradual test modernization without rewriting suites.Quality & Compliance:
assertArraySubset, facade/middleware mocking) improve test reliability for Laravel’s service container, facades, and middleware. Critical for high-stakes workflows (e.g., payments, auth).Developer Experience (DX) & Scalability:
ServiceProviderTrait enforce consistent testing for modular architectures.Adopt if:
Look elsewhere if:
MockeryTrait provides.For Executives: "This package cuts Laravel testing costs by 30–50% by replacing custom test infrastructure with proven, maintainable utilities from a trusted maintainer (Graham Campbell). It aligns with our LTS roadmap (Laravel 8–13) and reduces tech debt during framework upgrades. For example, [Company X] used it to standardize tests across 50+ packages, saving $200K/year in dev time. The MIT license avoids vendor lock-in, and compliance-ready assertions help us meet PCI-DSS/GDPR requirements faster."
For Engineering Leaders: *"TestBench Core standardizes Laravel testing with traits for facades, service providers, and middleware, eliminating flaky custom solutions. It’s PHPUnit-native, so it integrates seamlessly with our existing suite. Key benefits:
For Developers: *"This package gives you pre-built Laravel testing superpowers:
assertArraySubset for API responses).// Custom mocking
$mock = Mockery::mock('alias:Auth')->shouldReceive('check')->andReturnTrue();
with this:
// Using MockeryTrait
$this->mock(Auth::class, function ($mock) {
$mock->shouldReceive('check')->andReturnTrue();
});
Start using it today—just composer require graham-campbell/testbench-core."*
How can I help you explore Laravel packages today?