- What is open-dxp/test-foundation used for?
- It is the OpenDxp testing library: a testing foundation for Laravel and PHP projects. It provides a shared base test case, reusable assertions, and helper utilities so that PHPUnit or Pest suites can be bootstrapped consistently across packages and applications. Instead of every package re-inventing its own test scaffolding, teams extend the foundation and share one set of conventions.
- How do I install open-dxp/test-foundation with Composer?
- Install it with Composer from the root of your package or application, for example composer require --dev open-dxp/test-foundation. Because it is a testing library, it belongs in the require-dev section so it is not pulled into production installs. After installation, autoloading is handled by Composer and the base test case becomes available to your suite.
- Should open-dxp/test-foundation go in require-dev?
- Yes. Testing libraries are only needed while running PHPUnit or Pest, so keep the dependency in require-dev. That way production deployments using composer install --no-dev stay lean and do not ship test-only code. In a monorepo, add it to each package's require-dev or to the shared development dependencies of the root composer.json.
- Does open-dxp/test-foundation work with Pest as well as PHPUnit?
- Yes. The package is built to support consistent PHPUnit or Pest suites, so you can use whichever runner your project prefers. In PHPUnit you typically extend the provided base test case class, while in Pest you bind that same class as the base test case in your Pest configuration. This keeps behaviour identical regardless of the runner.
- How do I use the shared base test case in my own package?
- Extend the foundation's base test case from your package's tests, or reference it as the default test case in your Pest configuration file. Your own tests then inherit the shared setup, assertions, and helpers without duplicating boilerplate. Package-specific setup can still be added in your own setUp method, calling the parent implementation as usual.
- Can I use open-dxp/test-foundation in a plain PHP project without Laravel?
- The library targets Laravel and PHP projects, so it is not limited to full Laravel applications. Plain PHP libraries and packages can use the base test case and helper utilities as long as the required PHP and dependency constraints are met. Laravel-specific behaviour naturally requires a Laravel application or a package bootstrapping tool.
- What reusable assertions and helper utilities does it provide?
- The package ships reusable assertions and helper utilities that reduce duplicated expectation code across your test suites. The exact set of assertions grows with the library, so check the repository README and source for the current list before relying on a specific helper. The intent is that common checks are written once in the foundation and reused by every package.
- Which PHP and Laravel versions are supported?
- Supported versions are declared in the package's composer.json, so check the php and illuminate or laravel constraints for the release you plan to install. Match that against your own composer.json before requiring it. If you maintain packages on several framework versions, pin the foundation version that aligns with the oldest Laravel release you still support.
- Is open-dxp/test-foundation a replacement for Orchestra Testbench?
- No. Orchestra Testbench is the common way to boot a Laravel application inside a package's tests, while this foundation focuses on the shared base test case, assertions, and helper layer. Many Laravel packages will use both: Testbench for application bootstrapping and the foundation for consistent test conventions and assertions. Review the README to confirm how it fits your existing setup.
- How does it help keep test suites consistent across packages in a monorepo?
- By centralising the base test case, assertions, and helpers in one Composer package, every package in the monorepo extends the same foundation instead of copying setup code. Upgrading test conventions then means bumping a single dependency rather than editing dozens of suites. For release notes and known issues, follow the repository at github.com/open-dxp/test-foundation.