roundly-consulting/testing-for-laravel
A Laravel testing package that provides practical helpers and assertions to streamline feature and unit tests. It reduces boilerplate and makes it easier to write clear, reliable tests for Laravel applications, from HTTP interactions to application behavior.
Architecture fit. Based on 1.6.1, the package functions as a Laravel package-testing harness: a PackageTestCase base class that owns database lifecycle for downstream package test suites, exposing overridable hooks (migrationSources()) and a schema-reuse optimization (keepsMigratedSchema()). It is a dev-only concern that plugs into Laravel's migration runner and the configured DB connection rather than into application runtime code. That is a good architectural fit for teams maintaining multiple first-party Laravel packages that need consistent per-test database isolation.
Integration feasibility. Low effort. Adoption is a require-dev entry, extending PackageTestCase in each package's test suite, and declaring migration sources. No service provider, config publishing, or production wiring appears to be required.
Technical risk. 1.6.1 is a patch, but it changes observable behavior: suites whose migrationSources() is empty previously failed every database test with no such table: migrations and will now pass. Two implications: (1) any team that "fixed" the symptom by adding a dummy migration source or a migrations table fixture should re-check that workaround, since the underlying path is now a no-op; (2) keepsMigratedSchema() is now explicitly a no-op when nothing is migrated, so hand-built fixture tables are dropped between tests — tests that implicitly depended on cross-test residue were already broken, but the failure will now surface differently. Risk is bounded because the release notes describe no API removal or signature change. Evidence is limited to the release notes; I have not reviewed the diff, the semver posture of prior releases, or the engine matrix.
Key questions.
migrationSources() and pass only because of a workaround?Stack fit. Direct fit for a Laravel/PHP estate using PHPUnit or Pest with MySQL/Postgres/SQLite test databases. The package does not constrain the application stack; it constrains only how package test suites bootstrap schema.
Migration path. No code migration required. Bump require-dev to ^1.6.1, refresh the lockfile, and run the full suite. The only suites whose results should change are those with an empty migrationSources(), and they should change from red to green. Teams that added workarounds for the spurious failure should remove them in the same PR to avoid carrying dead scaffolding.
Compatibility. Presumed unchanged PHP/Laravel support matrix and unchanged public surface. Verify against Pest and PHPUnit versions in use, and against any parallel test runner (--parallel) where each worker gets its own database — the drop-per-test reset interacts with worker-level schema setup, so confirm per-worker bootstrapping still holds.
Sequencing.
migrationSources() to lock in the 1.6.1 semantics.Maintenance. Dev-only dependency with near-zero production blast radius. Maintain it through automated dependency PRs with the test suite as the gate; no runtime on-call exposure. The main ongoing cost is keeping the per-package adoption consistent so suites do not diverge in reset behavior.
Support. The 1.6.1 note reads as a considered bugfix — it explains the failure, the corrected behavior, and the fixture-table consequence — which is a positive signal for maintainer quality. Still unverified: issue tracker responsiveness, whether this was reported by a user or caught internally, and how long the false-failure existed. If this package is a single-maintainer project, budget for a fork-or-replace contingency.
Scaling. The design choice between drop-per-test reset and a retained schema snapshot is the dominant scaling lever: as migration counts and suite size grow, drop-per-test becomes the runtime bottleneck, and the snapshot path is what keeps CI time flat. 1.6.1 improves reliability of the fast path's guard conditions but does not change the performance characteristics. Measure suite wall time before and after adoption across the largest package to confirm the optimization is engaging rather than silently falling back.
Failure modes.
no such table: migrations on suites with no migration sources.keepsMigratedSchema() is a no-op, hand-built fixture tables vanish between tests — correct isolation, but any test that relied on residue fails at a distance from the cause. Encourage per-test fixture construction.migrations table can behave differently across engines with differing DDL/transaction semantics; the release note's "on every engine" claim needs CI evidence.Ramp-up. Low. Any engineer who has written Laravel package tests can adopt this in under an hour. The one concept worth documenting explicitly is the reset-mode contract: empty migrationSources() means nothing is migrated, therefore nothing is kept, therefore drop-per-test applies. Making that contract visible in the internal testing guide prevents the next round of confusion.
How can I help you explore Laravel packages today?