maks3w/phpunit-methods-trait
PHP trait exposing PHPUnit TestCase helper methods for use inside reusable test traits. Lets traits call mocking, expectations, and other TestCase APIs without extending TestCase directly; assertions are via PHPUnit\Framework\Assert.
getMock, assert*) without direct TestCase dependency, aligning with SOLID principles.Adopt when:
getMockBuilder, assert*).Look elsewhere if:
phpunit/phpunit for core features).For Executives: "This package solves a hidden productivity drain for our PHP test suite. By enabling IDE autocompletion for PHPUnit methods in reusable test traits, we can reduce debugging time and onboarding friction for new engineers—especially critical as we scale test automation. It’s a low-risk, zero-cost upgrade (BSD license) that aligns with our investment in cleaner, modular test code. For ~$0 in tooling, we gain measurable DX improvements with minimal maintenance."
For Engineering/DevOps:
"This trait provides static stubs for PHPUnit’s core methods (e.g., getMock, assert*) in traits, so your IDE recognizes them during development. No runtime overhead—just better autocompletion and fewer ‘method not found’ errors. Ideal if you’re using traits for shared test logic (e.g., @dataProvider helpers, mock factories). Works seamlessly with PHPUnit 9.x and adds zero complexity to your build pipeline. Tradeoff: Tiny package (1 star, but no dependents = no conflicts)."
For Developers:
*"Tired of your IDE underlining this->getMock() in red because it can’t resolve PHPUnit methods in traits? This package adds type hints and autocompletion for all TestCase methods when used in traits. Just use TestCaseTrait and get:
How can I help you explore Laravel packages today?