phpunit/phpunit-dom-assertions
Adds expressive DOM assertions to PHPUnit for testing HTML and XML output, letting you assert elements, attributes, text content, and structure using a fluent, readable API built on Symfony's DomCrawler and CssSelector components.
assertSelect* DOM assertions. Any Laravel/PHP app with a legacy suite that relies on them is pinned to an older PHPUnit, which in turn caps the Laravel/framework version, the PHP version, and eventually security patch cadence. This package is the cheapest known way to decouple "we have DOM assertions" from "we cannot upgrade PHPUnit." That's a roadmap unblocker, not a nice-to-have.grep -r "assertSelect" gives you the size of the work in minutes.Symfony\Component\DomCrawler, or (c) rewrite each call site to assertSee/assertSeeText or DomCrawler. Option (a) wins on time-to-value; option (b) wins on control and license certainty; option (c) wins on long-term hygiene but has the highest and lumpiest cost. This package lets you buy time to do (c) incrementally — that sequencing decision is the actual product call.require-dev dependency. It ships nothing to production, cannot affect runtime behavior, and cannot break customers. That materially lowers the bar for approval compared to a runtime library and is worth stating explicitly in any decision record.Adopt (as a pinned, temporary bridge) when:
dev-only, single-purpose dependency and can pin an exact version in composer.json.NOASSERTION license metadata, and an unresolved repository field. Treat the API as unstable until proven otherwise in your own CI.Look elsewhere when:
assertSee / assertSeeText / Symfony DomCrawler is a half-day and removes the dependency question entirely. Do that instead.NOASSERTION means the license could not be automatically determined from the package metadata. In many organizations that alone fails procurement. Before anything else, confirm the actual license from the repository/composer.json; if it's not a recognized permissive license (e.g. BSD-3-Clause, MIT), expect legal review and a possible no.Pre-adoption checklist (do these in order, cheap to expensive):
grep -r "assertSelect" tests/ | wc -l — size the problem. If it's small, stop here.For executives (one paragraph): Our test suite uses PHPUnit features that the project has deprecated and removed, which is currently holding us back from upgrading the framework and the PHP runtime. That upgrade is a prerequisite for staying on supported versions. This is a small, free, development-only package that restores those assertions so the upgrade can proceed now instead of after a multi-sprint test rewrite. It ships nothing to customers, carries no runtime risk, and is explicitly a bridge — the long-term plan is to migrate tests off it incrementally. The main caveats are that it is early-stage community software and its license needs a five-minute legal confirmation before we merge it. Ask: approve as a temporary dev dependency, and accept the framework upgrade as the deliverable it unblocks.
For engineering (the practical case): It's a drop-in replacement for the removed assertSelect* family, installed with composer require --dev, intended to require little or no change at call sites. Practical guidance: pin the exact version, run it green in CI on a branch before merging, and don't build new tests on it — for new work use assertSee/assertSeeText or Symfony DomCrawler directly. It's WIP with a small user base, so treat any unexpected assertion semantics as a bug to report or work around, not a contract. Have an exit: each migrated suite should be a candidate for conversion to first-party assertions, and the dependency should be gone within a couple of quarters. If the call-site count turns out to be small, kill the dependency and just rewrite — that's the better outcome and we should be willing to take it.
How can I help you explore Laravel packages today?